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

get-short-id

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-short-id - npm Package Compare versions

Comparing version 1.0.5 to 2.0.1

11

index.js

@@ -1,11 +0,12 @@

const {customAlphabet} = require('nanoid');
const {customAlphabet} = require("nanoid");
function getId(prefix, chars) {
prefix = typeof prefix === 'string' ? prefix : '';
chars = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_';
function getId({prefix, count, chars}) {
prefix = typeof prefix === "string" ? prefix : "";
chars = chars || "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
// generate 1k IDs/second and you will need 2 billion years to have 1% probability of 1 collision
// https://zelark.github.io/nano-id-cc/
return prefix + (customAlphabet(chars, 24)());
count = count || 24;
return prefix + (customAlphabet(chars, count)());
}
module.exports = getId;
{
"name": "get-short-id",
"version": "1.0.5",
"version": "2.0.1",
"description": "Random ID generator function with options to provide prefix and character set. Uses nanoid(23) as random string source.",

@@ -5,0 +5,0 @@ "main": "index.js",

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