@code-coaching/random
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @code-coaching/random

Weekly Downloads

0

Version

1.2.2

License

MIT

Unpacked Size

18.8 kB

Total Files

11

Last publish

Collaborators

  • bartduisters