0.0.3 • Published 2 years ago

@boatgame-io/id-utils v0.0.3

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
2 years ago

@krew-io/id-utils

Krew.io's official ID system.

ID Structure

IDs are created by combining an epoch date, a process ID, and an increment, similar to Twitter's Snowflake system. The Krew.io epoch is December 25th, 2020 0:00 UTC.

Snowflakes can be typed like so:

`${bigint}`

Snowflake typings are exported as KrewID.

Methods

You can create an ID using the following code:

import { createID } from '@boatgame-io/id-utils';
const newID = createID();

You can also extract dates with the getDate() method:

import { createID, getDate } from '@boatgame-io/id-utils';
const newID = createID();
const date = getDate(newID);