0.5.0 • Published 5 months ago

@temelj/id v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Installation

# npm
$ npm install @temelj/id
# jsr
$ deno add jsr:@temelj/id # or jsr add @temelj/id

Usage

Generate ULIDs.

import { generateUlid, generateUlidList } from "@temelj/id";

// e.g. 005800001A000G40R40M30E209
console.log(generateUlid({}));

// Generates 10 ULIDs with monotonicity.
console.log(generateUlidList(5));

Generate UUIDs.

import {
  generateUuid4,
  getUuid4Bytes,
  isUuid4Valid,
  makeUuid4FromBytes,
} from "@temelj/id";
import { assert, assertEquals } from "@std/assert";

const id = generateUuid4();
assert(isUuid4Valid(id));

const bytes = getUuid4Bytes(id);
assertEquals(id, makeUuid4FromBytes(bytes));

About

This package is part of Temelj - a big standard library for TypeScript.

0.5.0

5 months ago

0.2.1

5 months ago

0.2.0

5 months ago

0.1.5

7 months ago

0.1.4

8 months ago

0.1.3

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago