UNPKG

keystamp

Version:

A tiny, fast, and collision-resistant unique ID generator for JavaScript, React.js, Node.js, and Express.js, inspired by MiniQid.

33 lines (27 loc) 1.14 kB
// const keystamp = require('keystamp'); const keystamp = require("./index.js"); // Test 1: Generate 10 unique IDs with default settings console.log("Test 1: Default Settings"); for (let i = 0; i < 10; i++) { console.log(keystamp()); } // Test 2: Generate 10 unique IDs with a custom character set console.log("\nTest 2: Custom Character Set"); for (let i = 0; i < 10; i++) { console.log(keystamp({ type: 'custom+symbols', length: 40, customCharset: "ABC123" })); } // Test 3: Generate 10 unique IDs with a prefix and suffix console.log("\nTest 3: Prefix and Suffix"); for (let i = 0; i < 10; i++) { console.log(keystamp({ prefix: "user_", suffix: "_end", length: 20 })); } // Test 4: Generate 10 numeric IDs console.log("\nTest 4: Numeric IDs"); for (let i = 0; i < 10; i++) { console.log(keystamp({ type: 'numeric', length: 10 })); } // Test 5: Generate 10 unique IDs with a custom length console.log("\nTest 5: add multiple names to the same keystamp using '+' operator to combine types"); for (let i = 0; i < 10; i++) { console.log(keystamp({ type: 'alphanumeric+symbols', length: 20 })); }