Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@qrvey/id-generator

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qrvey/id-generator

![install size](https://packagephobia.com/badge?p=%40qrvey%2Fid-generator) ![coverage](https://img.shields.io/badge/unit_test_coverage-100%25-brightgreen)

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@qrvey/id-generator

install size coverage

The @qrvey/id-generator package provides a simple utility function to generate unique IDs using the nanoid library, with customizable alphabet and length.

Installation

You can install the package using npm or yarn:

npm install @qrvey/id-generator

Or with yarn:

yarn add @qrvey/id-generator

Usage

The getId function allows you to generate unique IDs with a customizable alphabet and length.

Default Configuration

  • alphabet: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
  • length: 21

Basic Example

import { getId } from '@qrvey/id-generator';

const id = getId(); 
console.log(id); // Example output: 'dZ3P1o2xY9B5RgTf8UAcW'

Custom Alphabet and Length

import { getId } from '@qrvey/id-generator';

const customAlphabet = '0123456789abcdef';
const customLength = 10;

const customId = getId(customAlphabet, customLength);
console.log(customId); // Example output: '4a8b7d3e1c'

FAQs

Package last updated on 16 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc