New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kvsrohit/shortid

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kvsrohit/shortid

minimal replacement of shortid module

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

@kvsrohit/shortid

ShortId (https://www.npmjs.com/package/shortid) has been an amazing module to generate short non-sequential url-friendly unique ids. However it is no longer maintained and suggests using NanoId (https://www.npmjs.com/package/nanoid) as replacement.

NanoId is simple and straight forward. However, it is not a drop-in replacement. Specially places where ShortId is a transient dependency.

This project uses NanoId and provides same interface as ShortId so that it can be used as drop-in resolution for transient dependencies.

Usage

const shortid = require('@kvsrohit/shortid');

console.log(shortid.generate());

Mongoose Unique Id

_id: {
  'type': String,
  'default': shortid.generate
},

API

const shortid = require('@kvsrohit/shortid');

shortid.generate()

Returns string non-sequential unique id.

Example

users.insert({
  _id: shortid.generate(),
  name: '...',
  email: '...'
});

FAQs

Package last updated on 16 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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