@chronark/prefixed-id
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "@chronark/prefixed-id", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -9,3 +9,9 @@ <div align="center"> | ||
A minimal library to generate Stripe inspired predixed ids for your application. | ||
Prefixed ids look like this: `pre_JUbF9zRGz9hrFXUyNJLXcowD9GsqCD`. They can be very useful if you | ||
have different entities and want to quickly identify them. | ||
Generated ids rely on the provided crypto implementation. If you use either `window.crypto` or | ||
`crypto` from "node:crypto", the ids will be cryptographically secure. | ||
Works in | ||
@@ -16,2 +22,3 @@ - Nodejs | ||
## Install | ||
@@ -58,1 +65,27 @@ | ||
``` | ||
## Options | ||
You may pass these options to the constructor to customize the id generation. | ||
```ts | ||
{ | ||
/** | ||
* | ||
* @default "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" | ||
*/ | ||
alphabet?: string; | ||
/** | ||
* Either window.crypto or crypto from node | ||
* | ||
* @default window?.crypto | ||
*/ | ||
crypto?: Crypto; | ||
/** | ||
* Byte size of the generated id | ||
*/ | ||
size?: number; | ||
}; | ||
``` |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25449
88
0