From e6cbf7c6c731ba8bb38bc6bb0b8bc0f6025ad548 Mon Sep 17 00:00:00 2001 From: James Moberg Date: Sun, 15 Jan 2023 09:12:05 -0800 Subject: [PATCH] Make compatible with Adobe ColdFusion 2016 --- lib/Cuid2.cfc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Cuid2.cfc b/lib/Cuid2.cfc index f856895..a230007 100644 --- a/lib/Cuid2.cfc +++ b/lib/Cuid2.cfc @@ -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 ); @@ -253,7 +252,7 @@ component } - return( value ) + return( value ); }