@ssts/id
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

Create unique random string IDs

One straight forward function that returns a random ID 😍

Install

npm i @ssts/id

Import

import seniorID from "@ssts/id";

Use

const randomId: string = seniorID();

Examples

import seniorID from "@ssts/id";

console.log(seniorID());                           // 'F5vvaP9D-4e5q-CTow-eUsx-P91RH0pph5Gy'
console.log(seniorID([8]));                        // 'ZILHou6J'
console.log(seniorID([8], "love"));                // 'lllloove'
console.log(seniorID([8], "love"));                // 'velvovvo'
console.log(seniorID([8], "love"));                // 'veoelole'
console.log(seniorID([4], "love"));                // 'lvel'
console.log(seniorID([8, 4]));                     // 'ChOUDIc-4fEf'
console.log(seniorID([8, 4, 4]));                  // 'FHF842Qz-YwMf-clAz'
console.log(seniorID([8, 4, 2]));                  // 'VidKqZr7-IEyN-Fp'
console.log(seniorID([8, 4, 2, 1]));               // 'EUWiP1Fv-eBWp-aw-t'
console.log(seniorID([8, 4, 4, 4, 12]));           // 'CULsKi5d-tP6u-ghe1-noGU-uemm0sxexuhY'
console.log(seniorID([8, 4, 4, 4, 12], "abc123")); // '21ac2b3c-b3a3-3ab3-cccb-13a313aaa1a2'

Arguments

Returns a string

Order Parameter Type Default
1 lengthArray number[] [8, 4, 4, 4, 12]
2 characters string "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"





Made With Chocolate By Senior Sedo 😎

Be Chocolateful 💙😍

ssts stands for senior-sedo-typescript 💙

So instead of @senior-sedo-typescript/rand-id

@ssts/id for simplicity sake 😍






Package Sidebar

Install

npm i @ssts/id

Weekly Downloads

7

Version

0.0.5

License

MIT

Unpacked Size

5.3 kB

Total Files

7

Last publish

Collaborators

  • seniorsedo