Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@leaf-x/snowflake

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leaf-x/snowflake

Twitter snowflake algorithm, TypeScript implementation.

  • 2.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Snowflake

Twitter snowflake algorithm, TypeScript implementation.

Installation

npm install @leaf-x/snowflake --save

Params

NameTypeDefault ValueDescription
dataCenterIdNumber0Data center ID, value range 0-31.
workMachineIdNumber0Work machine ID, value range 0-31.
twEpochNumberRequiredTimestamp of the start of the snowflake algorithm.

Use

import snowflake from '@leaf-x/snowflake';

const newId = snowflake({
  dataCenterId: 0,
  workMachineId: 0,
  twEpoch: 1583734327332,
});

const id = newId();

console.info(id);

FAQs

Package last updated on 16 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc