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

@chronark/prefixed-id

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chronark/prefixed-id - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

2

package.json
{
"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;
};
```
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