@semperfortis/snowflakejs
v1.0.1
Published
Twitter's Snowflake implementation for javascript
Downloads
62
Readme
snowflakejs
SnowflakeJS is a Twitter snowflake generator and deconstructor for JavaScript based on snowflake-js.
Installation
$ yarn add @semperfortis/snowflakejs
Usage
Generate a snowflake
import { generate } from '@semperfortis/snowflakejs';
// optional epoch, defaults to current date
const snowflake = generate({ epoch: 1577833200000 });
console.log(snowflake);
Return snowflake creation date
import { deconstruct } from '@semperfortis/snowflakejs';
// optional epoch, defaults to current date
const date = deconstruct(snowflake, { epoch: 1577833200000 });
console.log(date);