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 3.0.5 to 3.0.7

18

index.ts

@@ -1,2 +0,2 @@

import {customAlphabet} from 'nanoid';
import { customAlphabet } from "nanoid";

@@ -6,5 +6,5 @@ export default function getId(options: {

* @param {string} If prefix = "u-" IDs will be something like: u-a487t6grede...
* @description getId({ prefix: `u-${Date.now()}`, count: 14 })
* @description getId({ prefix: `u-${Date.now()}` })
* */
prefix?: string,
prefix?: string;
/**

@@ -14,3 +14,3 @@ * @param {number} How many chars to use. Default is 14

* */
count?: number,
count?: number;
/**

@@ -20,7 +20,9 @@ * @param {string} Chars to use. Default is A-z0-9_

* */
chars?: string
chars?: string;
}): string {
let prefix = options?.prefix || '';
let chars = options?.chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_';
let count = options?.count || 24;
let prefix = options?.prefix || "";
let chars =
options?.chars ||
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
let count = options?.count || 14;

@@ -27,0 +29,0 @@ // some math to check probability of collision

{
"name": "get-short-id",
"version": "3.0.5",
"version": "3.0.7",
"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