Comparing version 1.2.1 to 1.2.2
@@ -33,2 +33,8 @@ /** | ||
safeCounter = function () { | ||
c = (c < discreteValues) ? c : 0; | ||
c++; // this is not subliminal | ||
return c - 1; | ||
}, | ||
api = function cuid() { | ||
@@ -55,7 +61,4 @@ // Starting with a lowercase letter makes | ||
c = (c < discreteValues) ? c : 0; | ||
counter = pad(c.toString(base), blockSize); | ||
counter = pad(safeCounter().toString(base), blockSize); | ||
c++; // this is not subliminal | ||
return (letter + timestamp + counter + fingerprint + random); | ||
@@ -66,3 +69,3 @@ }; | ||
var date = new Date().getTime().toString(36), | ||
counter = c.toString(36).slice(-1), | ||
counter, | ||
print = api.fingerprint().slice(0,1) + | ||
@@ -72,3 +75,3 @@ api.fingerprint().slice(-1), | ||
c++; | ||
counter = safeCounter().toString(36).slice(-1); | ||
@@ -75,0 +78,0 @@ return date.slice(2,4) + date.slice(-2) + |
@@ -33,2 +33,8 @@ /** | ||
safeCounter = function () { | ||
c = (c < discreteValues) ? c : 0; | ||
c++; // this is not subliminal | ||
return c - 1; | ||
}, | ||
api = function cuid() { | ||
@@ -55,7 +61,4 @@ // Starting with a lowercase letter makes | ||
c = (c < discreteValues) ? c : 0; | ||
counter = pad(c.toString(base), blockSize); | ||
counter = pad(safeCounter().toString(base), blockSize); | ||
c++; // this is not subliminal | ||
return (letter + timestamp + counter + fingerprint + random); | ||
@@ -66,3 +69,3 @@ }; | ||
var date = new Date().getTime().toString(36), | ||
counter = c.toString(36).slice(-1), | ||
counter, | ||
print = api.fingerprint().slice(0,1) + | ||
@@ -72,3 +75,3 @@ api.fingerprint().slice(-1), | ||
c++; | ||
counter = safeCounter().toString(36).slice(-1); | ||
@@ -75,0 +78,0 @@ return date.slice(2,4) + date.slice(-2) + |
{ | ||
"name": "cuid", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Collision-resistant ids optimized for horizontal scaling and performance. For node and browsers.", | ||
@@ -9,3 +9,3 @@ "author": { | ||
"url": "http://ericleads.com" | ||
}, | ||
}, | ||
"main": "./dist/node-cuid.js", | ||
@@ -12,0 +12,0 @@ "browserify": "./dist/browser-cuid.js", |
@@ -33,2 +33,8 @@ /** | ||
safeCounter = function () { | ||
c = (c < discreteValues) ? c : 0; | ||
c++; // this is not subliminal | ||
return c-1; | ||
}, | ||
api = function cuid() { | ||
@@ -55,7 +61,4 @@ // Starting with a lowercase letter makes | ||
c = (c < discreteValues) ? c : 0; | ||
counter = pad(c.toString(base), blockSize); | ||
counter = pad(safeCounter().toString(base), blockSize); | ||
c++; // this is not subliminal | ||
return (letter + timestamp + counter + fingerprint + random); | ||
@@ -66,3 +69,3 @@ }; | ||
var date = new Date().getTime().toString(36), | ||
counter = c.toString(36).slice(-1), | ||
counter, | ||
print = api.fingerprint().slice(0,1) + | ||
@@ -72,3 +75,3 @@ api.fingerprint().slice(-1), | ||
c++; | ||
counter = safeCounter().toString(36).slice(-1); | ||
@@ -75,0 +78,0 @@ return date.slice(2,4) + date.slice(-2) + |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
405011
11389
169