Skip to content

Commit

Permalink
Make compatible with Adobe ColdFusion 2016
Browse files Browse the repository at this point in the history
  • Loading branch information
JamoCA authored Jan 15, 2023
1 parent 03436e4 commit e6cbf7c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/Cuid2.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,12 @@ component
// variable-length string.
var result = BigIntegerClass
.init( bytes )
.toString( 36 )
// NOTE: In the JavaScript version of CUID2, Eric Elliott removes the first
// two letters of the hash. His note says that the first two letters bias the
// generated CUIDs towards a narrower set of values. Anecdotally, I do see the
// dash ("-") showing up a lot unless I remove the first 2 characters as well.
.right( -2 )
;
.toString( 36 );
// NOTE: In the JavaScript version of CUID2, Eric Elliott removes the first
// two letters of the hash. His note says that the first two letters bias the
// generated CUIDs towards a narrower set of values. Anecdotally, I do see the
// dash ("-") showing up a lot unless I remove the first 2 characters as well.
result = right(result, len(result)-2);

return( result );

Expand Down Expand Up @@ -253,7 +252,7 @@ component

}

return( value )
return( value );

}

Expand Down

0 comments on commit e6cbf7c

Please sign in to comment.