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

@webextensions/simpleid

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webextensions/simpleid

Generate simple unique IDs (simpleid)

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by800%
Maintainers
2
Weekly downloads
 
Created
Source

simpleid

Generate simple unique ID strings (simpleid)

Rules

  • A simpleid is an alphanumeric code (- can be used as a separator)
  • A simpleid contains 12 key characters (by default)
  • Same character won't repeat consecutively
  • A character will not be followed by the keys to its left or right on a QWERTY keyboard
  • The first character will be an alphabet
  • The following characters are not allowed due to potential of typo: 0, o, 1, i and l

Notes

Currently, there are no specific restrictions for:

  • String length (default length is 12 characters)
  • Case-sensitivity (the implementation should handle different cases as same or different)
  • Handling mixed casing (The library generates only lowercase or uppercase strings)
  • Versioning for the definition of a valid simpleid

Usage - via Command line

Without installing

$ npx @webextensions/simpleid

Install and run

$ npm install --global @webextensions/simpleid
$ simpleid
qn3k-vqtw-rp72
$ simpleid --case upper
P6HK-8NRM-RM6G
$ simpleid --multiple 5
f3hw-cmwb-7m6g
q49j-2tc7-wx8s
kgvj-n4cj-5xs5
wjzb-w6jz-fjv8
qsk4-x59m-pvp4
$ simpleid --help
# Shows the help

Usage - via Code

General

const { simpleid } = require('@webextensions/simpleid');
const id = simpleid();
console.log(id); // swsk-3c3r-czwt

Advanced

const {
    simpleid,
    simpleidLowerCase,
    simpleidUpperCase,
    hyphenateId,
    unhyphenateId
} = require('@webextensions/simpleid');

const
    id1 = simpleid(),                        // vm6f-85s7-k96p
    id2 = simpleidLowerCase(),               // qxwz-9r7z-rvtp
    id3 = simpleidUpperCase(),               // F4QM-2SMW-2J2C
    withoutHyphen = unhyphenateId(id3),      // F4QM2SMW2J2C
    withHyphen = hyphenateId(withoutHyphen); // F4QM-2SMW-2J2C

Keywords

FAQs

Package last updated on 24 Sep 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