@agrozyme/flake
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@agrozyme/flake

這是用 TypeScript 實作的一個全局全時的發號器,可以產生一個長度為 39 Bytes 的字串。

該字串為 16 進位字串,其中包括 3 個連字號 (Dash: - )。

我參考了 flake 這個模組來改寫。

主要的差異在於:

  • 自動取得可能的 MAC Address
  • 參考各項目的最大可能值來調整各欄位的長度

字串格式

  • Format: [timestamp]-[count]-[pid]-[mac]
  • Bytes: 14 - 4 - 6 - 12
  • Total: 14 + 4 + 6 + 12 + 3 = 39

用法

JavaScript

const Flake = require('@agrozyme/flake');
const identity = Flake.makeOne();
const list = Flake.makeList(10);

TypeScript

import { Flake } from '@agrozyme/flake';
const identity = Flake.makeOne();
const list = Flake.makeList(10);

Readme

Keywords

none

Package Sidebar

Install

npm i @agrozyme/flake

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

14.6 kB

Total Files

13

Last publish

Collaborators

  • agrozyme