maxuniqid
Make counter functions that deliver, one-by-one, all available integers: 0, 1, …, MAX_INT, -1, -2, …, MIN_INT, then throw a RangeError. AMD/UMD package.
Usage
From test/usage.js:
var ids makeIdCounter = nextId = MAX_ID = NumberMAX_SAFE_INTEGER + 1 MIN_ID = NumberMIN_SAFE_INTEGER - 1; ids = ;; nextId;ids = ;; nextId;ids = ;; nextId;ids = ;; // Make sure our MAX_ID really touches the limit:; nextId;ids = ;; // Make sure our MIN_ID really touches the limit:; nextId;ids = ;; try ids = 'still alive'; ; catch err ids = Stringerr;;
License
ISC