@@ -4,7 +4,7 @@ import { valueChangeAnim } from '../../animations/common-animations';
44import { Meta } from '@angular/platform-browser' ;
55import { FormsModule } from '@angular/forms' ;
66import { v4 as uuidv4 } from 'uuid' ;
7- import { nanoid } from 'nanoid' ;
7+ import { nanoid } from 'nanoid' ;
88
99@Component ( {
1010 selector : 'app-id-generator' ,
@@ -13,14 +13,14 @@ import {nanoid} from 'nanoid';
1313 templateUrl : './id-generator.component.html' ,
1414 animations : [ valueChangeAnim ]
1515} )
16- export class IdGeneratorComponent {
16+ export class IdGeneratorComponent {
1717 protected status : boolean = false ;
1818 protected idsCode : string = "" ;
1919 protected isGuid : boolean = true ;
2020 protected uppercase : boolean = false ;
2121 protected hyphen : boolean = true ;
2222 protected base64 : boolean = false ;
23- // protected rfc7515: boolean = false;
23+ protected rfc7515 : boolean = false ;
2424 protected urlEncode : boolean = false ;
2525 protected count : number = 7 ;
2626 protected prepend : string = "{\"" ;
@@ -38,11 +38,11 @@ export class IdGeneratorComponent {
3838 protected generate ( ) {
3939 this . idsCode = "" ;
4040 for ( let i = 0 ; i < this . count ; i ++ ) {
41- let id = this . isGuid ? uuidv4 ( ) . toString ( ) : nanoid ( ) . toString ( ) ;
41+ let id = this . isGuid ? uuidv4 ( ) . toString ( ) : nanoid ( ) . toString ( ) ;
4242 if ( this . uppercase ) id = id . toUpperCase ( ) ;
4343 if ( this . isGuid ) if ( ! this . hyphen ) id = id . replaceAll ( "-" , "" ) ;
4444 if ( this . base64 ) id = btoa ( id ) ;
45- // if (this.rfc7515) id = id.replace(/\+/g , "-").replace(/\//g , "_").replace(/=/g , "");
45+ if ( this . base64 ) if ( this . rfc7515 ) id = id . replaceAll ( "+" , "-" ) . replaceAll ( "/" , "_" ) . replaceAll ( "=" , "" ) ;
4646 if ( this . base64 ) if ( this . urlEncode ) id = encodeURIComponent ( id ) ;
4747 this . idsCode += this . prepend + id + this . append + "\n" ;
4848 }
0 commit comments