uniquechars

1.1.5 • Public • Published

uniquevalues

Generate random strings and numbers from from strings or group of numbers. Good for generating unique ids and strings.

Installation

npm install uniquechars

Usage

1. To get unique random strings

With ES6 module syntax

To get unique random strings without parameters

import { UNIQUE_STRING } from 'uniquechars'
 
console.log(UNIQUE_STRING()) // ⇨ 'QB|941@D#XK&5YD7' for example

To get unique random strings with parameters

import { UNIQUE_STRING } from 'uniquechars'
 
console.log(UNIQUE_STRING(string, length)) // ⇨ 'QB|941@D#XK&5YD7' for example

With CommonJS syntax

To get unique random strings without parameters

let { UNIQUE_STRING } = require('uniquechars')
 
console.log(UNIQUE_STRING()) // ⇨ 'QB|941@D#XK&5YD7' for example

To get unique random strings with parameters

let { UNIQUE_STRING } = require('uniquechars')
 
console.log(UNIQUE_STRING(string, length)) // ⇨ 'QB|941@D#XK&5YD7' for example

String must be a string data type and length must be a number data type.

2. To get unique random number

With ES6 module syntax

To get unique random strings without parameters

import { UNIQUE_NUMBER } from 'uniquechars'
 
console.log(UNIQUE_STRING()) // ⇨ '1098276235427165' for example

To get unique random strings with parameters

import { UNIQUE_NUMBER } from 'uniquechars'
 
console.log(UNIQUE_STRING(string, length)) // ⇨ '1098276235427165' for example

With CommonJS syntax

To get unique random strings without parameters

let { UNIQUE_NUMBER } = require('uniquechars')
 
console.log(UNIQUE_STRING()) // ⇨ '1098276235427165' for example

To get unique random strings with parameters

let { UNIQUE_NUMBER } = require('uniquechars')
 
console.log(UNIQUE_STRING(number, length)) // ⇨ '1098276235427165' for example

Number must be a number data type and length must be a number data type.

3. To get unique random password

With ES6 module syntax

To get unique random password without parameters

import { UNIQUE_PASS } from 'uniquechars'
 
console.log(UNIQUE_PASS()) // ⇨ 'QB|941@D#XK&5YD7' for example

To get unique random password with parameters

import { UNIQUE_PASS } from 'uniquechars'
 
console.log(UNIQUE_PASS(string, length)) // ⇨ 'QB|941@D#XK&5YD7' for example

With CommonJS syntax

To get unique random password without parameters

let { UNIQUE_PASS } = require('uniquechars')
 
console.log(UNIQUE_PASS()) // ⇨ 'QB|941@D#XK&5YD7' for example

To get unique random password with parameters

let { UNIQUE_PASS } = require('uniquechars')
 
console.log(UNIQUE_PASS(string, length)) // ⇨ 'QB|941@D#XK&5YD7' for example

String must be a string data type and length must be a number data type.

Default parameters

console.log(UNIQUE_STRING(string, length)) // ⇨ 'QB|941@D#XK&5YD7' for example
 
string = "#@%&*!(){}[]=_+|/\/ABCDEFGHIJKLMOPQRSTUVWXYZ1234567890"
 
length = 16
console.log(UNIQUE_NUMBER(number, length)) // ⇨ '1098276235427165' for example
 
number = "1234567890"
 
 
length = 16
console.log(UNIQUE_PASS(string, length)) // ⇨ 'QB|941@D#XK&5YD7' for example
 
 
string = "#@%&*!(){}[]=_+|/\/ABCDEFGHIJKLMOPQRSTUVWXYZ1234567890"
 
 
length = 16

Author

Valentine Elum

License

MIT LICENSE

Package Sidebar

Install

npm i uniquechars

Weekly Downloads

9

Version

1.1.5

License

MIT

Unpacked Size

9.96 kB

Total Files

6

Last publish

Collaborators

  • vahlcode