📅  最后修改于: 2023-12-03 14:44:34.592000             🧑  作者: Mango
newId is a library for generating unique identifiers in JavaScript. The library provides flexible and easy-to-use methods for generating unique identifiers, perfect for use in applications that require unique IDs for entities such as users, products, orders, etc.
newId can be installed via npm:
npm install newid
const newId = require('newid');
const id = newId();
console.log(id); // Output: 5F7B1CBE-143D-4B39-B8E5-6D0A1567B484
newId provides a single function for generating unique identifiers:
Generates a new unique identifier.
prefix
(optional): A string to prepend to the identifier. Defaults to an empty string.length
(optional): The desired length of the identifier, not including the prefix. The default length is 36 characters.const id = newId('order', 8); // Output: order-IbtY9Iwo
newId is released under the MIT License.