short-id
Self-contained short-life ID generating module
Not guarenteed to be unique outside of a single instance of the module.
Install
$ npm install short-id
Usage
var ids = ; ids; // "aeaf15"ids; // "1d0449" ids; // "8dbd46"ids; // 'foo' ids;ids; // undefined
ids.generate ( void )
Generates a new ID string and returns it.
ids.invalidate ( String key )
Invalidates the given id key, removing any data stored with it and recycling it.
ids.store ( mixed value )
Generates a new key and stores a value under that key.
ids.fetch ( String key )
Looks up a value stored under the given key.
ids.fetchAndInvalidate ( String key )
The equivilent of calling fetch
and then invalidate
. Returns the stored value.
ids.configure ( Object conf )
Changes configuration values.
// Call to configure shown with the default valuesids;