Skip to content

Reference implementation of nanoflakes for JavaScript.

License

Notifications You must be signed in to change notification settings

nanoflakes/nanoflakes-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nanoflakes - JavaScript

npm GitHub issues License Twitter

Reference implementation of nanoflakes for JavaScript.

Licensed under the MIT License.

Installation

Run the following command to install the package:

# on NPM...
$ npm install nanoflakes

# on Yarn...
$ yarn add nanoflakes

Usage

  • Use localGenerator(epoch, generatorId) to create a local nanoflake generator.
    • You can get an epoch by calling Date.now() in a Node.js shell.
    • A generator ID must be in the 0-1023 range.
  • Use NanoflakeGenerator.next() to get a new nanoflake.
  • The Nanoflake class is the result type NanoflakeGenerator.next(). It can be used as-is, or getting it's raw or encoded value. It also features utility methods such as getting the creation time of the nanoflake.

Support

Extra support is given on Cafeteria Development.

Aru's Discord Server

Releases

No releases published

Packages

No packages published