time-uuid
Universally unique identifier in short web friendly (non UUID) format
Last updated 9 years ago by medikoo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install time-uuid 
SYNC missed versions from official npm registry.

time-uuid

Universally unique identifier in short web-friendly format.

Generated id's are composed out of current microseconds stamp, and random string.

Usage

Generate id based on current time and random string:

var generateId = require('time-uuid');
console.log(generateId()); // 7e7b249ksny
console.log(generateId()); // 7e7b249wyjy
console.log(generateId()); // 7e7b24ahlgy

Get unique time (in microseconds):

It doesn't guarantee accurate time representation, in first place it's about provision of unique microtime value and optionally it relies on some microtime provider which may not be available in current environement

var getTime = require('time-uuid/time');
console.log(getTime()); // 1356631360599486
console.log(getTime()); // 1356631360599698
console.log(getTime()); // 1356631360603625

Get unique id out of given microtime value

var getIdByTime = require('time-uuid/get-by-time');
console.log(getIdByTime(getTime())); // 7e7b24alj5y
console.log(getIdByTime(getTime())); // 7e7b24aljyy
console.log(getIdByTime(getTime())); // 7e7b24alkhy

Installation

$ npm install time-uuid

To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: Browserify, Webmake or Webpack

Tests Build Status

$ npm test

Current Tags

  • 1.0.0                                ...           latest (9 years ago)

4 Versions

  • 1.0.0                                ...           9 years ago
  • 0.2.1                                ...           11 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 4
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE