paralleldrive / cuid

Collision-resistant ids optimized for horizontal scaling and performance.
Other
3.44k stars 123 forks source link

Can you provide some example? #4

Closed mike-aungsan closed 11 years ago

mike-aungsan commented 11 years ago

module.exports = (function() {

I try the following. only slug(), and fingerprint return 5 chars.

How do I get longer one?

Regards,

var cuid = require('cuid'); var id = new cuid();

return function(req, res, next) {

console.log('cuid module');

//console.log(cuid);
//console.log(id);

//console.log(cuid.fingerprint());  // short, 5 chars
//console.log(cuid.slug());   // work, short one
console.log(cuid.cuid());
//console.log(cuid.nodePrint());

console.log(id.cuid());
//console.log(id.fingerprint());
//console.log(id.slug());   // work, short one
//console.log(id.nodePrint());

next();

}

})();

ericelliott commented 11 years ago

Looks like you tried everything except:

var cuid = require('cuid');
console.log( cuid() );
mike-aungsan commented 11 years ago

Thanks lots.

ericelliott commented 11 years ago

I updated the doc. Thanks for asking. =)