1.1.2 • Published 2 years ago

ufid v1.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
2 years ago

NPM version Build Status Dependency Status

ufid

URL friendly reasonably unique ids.

Install

$ npm install --save ufid

Usage

Generate uids with only numbers and letters (both uppercase and lowercase):

const { generator } = require('ufid');
const uid = generator({ size: 10 });

uid();  // 10 characters long
uid();  // another one - also 10 characters long
uid(8); // another one 8 characters long

With custom alfabet:

const { generator } = require('ufid');
const uid = generator({ size: 12, alphabet: 'abc0123A' });

uid();  // 12 characters long, only a-c, 0-3, and A

With custom byte stream:

const { generator } = require('ufid');
const byteStream = {
  next: () => Math.random() * 62
};
const uid = generator({ size: 6, byteStream });

uid();  // 6 characters long using non-secure random

License

MIT © Damian Krzeminski

1.1.2

2 years ago

1.1.1

3 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.0

5 years ago