npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

easy-key-generator

v1.1.11

Published

Easy library for generating secret keys. It supports various features like groups, separators, key format, and the possibility of generating multiples keys at once.

Downloads

23

Readme

Easy Key Generator

What is this package for?

Do you want to be able to generate random codes/keys to use in your application? This library enables you just that.

Key formats

With easy-key-generator you can generate keys like these:

SBWPR-G6NOE-ZAQBO (Letters and Numbers)

26960-74535-48967-85294 (Numbers Only)

YUNIE-QHQDT (Letters Only)

A37B1-7733F-CBC20 (Using Hexadecimal characters)

Quick setup

npm install easy-key-generator

Import

const KeyGenerator = require("easy-key-generator");

or

import KeyGenerator from "easy-key-generator";

Setup

const myKeyGenerator = new KeyGenerator(5); // Setup to generate a 5 character key

const generatedKey = myKeyGenerator.generate();

console.log(generatedKey); // ["H52N4"]

Alternatively, you can use:

const generatedKey = new KeyGenerator(5).generate();

Special Properties

These are the optional properties you can pass as a second parameter to the constructor:

charaterType

groups

groupSeparator

groupFormat

numberOfKeys

characterType can only be assigned with the following values:"Letters", "Numbers", "LettersAndNumbers" (default), "HexChar"

separatorType can only be assigned with the following values: "-" (default), "_", "/" "." and " ".

Implementing props

const props = {
  characterType: "LettersAndNumbers", //Default is LettersAndNumbers
  groups: 3, // Default is 1
  groupSeparator: "-", // Default is "-"
  groupFormat: "LLNLN", // L: Letters | N: Numbers,
  numberOfKeys: 10, // Default is 1
};

const myKeys = new KeyGenerator(5, props).generate();

console.log(myKeys);
/* Will Output and array of 10 keys
 * containing 3 groups with the group
 * format LLNLN and using letters
 * and numbers
[
  'JO7I5-PN2U3-DA5Y4',
  'NK7S1-CS6F7-IE4T5',
  'AA1G1-QP3S3-BF1Q8',
  'WB5A8-ZN1J0-SO9Z0',
  'YT6C8-YU1Z5-PG2Y0',
  'OM7H1-TG5S7-GF9O4',
  'IR1F5-WY3B9-RM8A0',
  'CX9Q9-CO5W2-RE8H6',
  'ON6T5-IH1T1-XC0W7',
  'PX8M9-KK6H8-DY5D2'
]
*/