Skip to content

Commit

Permalink
Merge pull request #1 from JamoCA/patch-2
Browse files Browse the repository at this point in the history
Make compatible with Adobe ColdFusion 2016
  • Loading branch information
bennadel committed Jan 15, 2023
2 parents 03436e4 + e6cbf7c commit 4cde7a2
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 4cde7a2

Please sign in to comment.