get-short-id
Advanced tools
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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76