@code-coaching/random
v1.2.2
Published
This package provides functions to generate random stuff (strings, numbers, uuid). It can be used as a dependency for other packages. It can be used as a CLI tool.
Downloads
2
Readme
Code Coaching - Random
This package provides functions to generate random stuff (strings, id, uuid). It can be used as a dependency for other packages. It can be used as a CLI tool.
Prerequisites
Usage
As a CLI tool
Using npx
to print out all possible options:
npx @code-coaching/random --help
Inside of a project
npm install @code-coaching/random
Examples
import { randomUUID } from "../dist/index.js";
// This will be: import { randomUUID } from "@code-coaching/random"; inside of a project.
console.log(randomUUID()); // This will generate a random UUID, e.g. b2c58d7e-f91a-4bc6-a5e6-25aa1ba0f573
import { randomID } from "../dist/index.js";
// This will be: import { randomID } from "@code-coaching/random"; inside of a project.
console.log(randomID()); // This will generate a random ID of length 8.
console.log(randomID(4)); // This will generate a random ID of length 4.
console.log(randomID(100)); // This will generate a random ID of length 100.
import { randomString } from "../dist/index.js";
// This will be: import { randomString } from "@code-coaching/random"; inside of a project.
console.log(randomString()); // Generates a random string of length 8.
console.log(randomString(4)); // Generates a random string of length 4.
console.log(randomString(100)); // Generates a random string of length 100.