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

@otumian-empire/somerandchar

v3.0.4

Published

somerandchar lets you generate random characters for your applications. You can generate some random characters of customizable length. You can also choose from the character set to generate these desired random characters from. The best part, somerandcha

Downloads

9

Readme

somerandchar

somerandchar lets you generate random characters for your applications. You can generate some random characters of customizable length. You can also choose from the character set to generate these desired random characters from. The best part, somerandchar has no dependencies thus flexibly customizable.

Install

clone

git clone https://github.com/Otumian-empire/somerandchar.git

npm

npm i @otumian-empire/somerandchar

Usage

Generate X numbers for token

// Need 6 numbers for token
const somerandchar = require("@otumian-empire/somerandchar");
const builder = new somerandchar();

// call the size method and pass the desired size as integer
// call the alnum method to numeric characters
// call the toString method to return the token
const result = builder.size(6).alnum().toString();
console.log(result);

// 895208
// 650209
// 888880

Generate long random alphabetic string for email verification

// Need long random alphabetic string for email verification,
// as part of url
// call alpha method and pass 128 to the size method
const somerandchar = require("@otumian-empire/somerandchar");
const builder = new somerandchar();

const result = builder.size(128).alpha().toString();
console.log(result);

//xtXFwErgKznP_ijDuhuwgsrkeolqxjKOPqXtrUgskiBWuMpTodMrRjTkqRlEaqWibpcAtFkt_VVHCZuAqncKwthUtvK_kRmzFPRkAVo_noPNo-WQxipikVxZzFTvxevm

Generate long random alphanumeric string for email verification

// Need long alphanumeric characters as token for email verification,
// as part of url - call alphanum and pass 64 to the size method
const somerandchar = require("@otumian-empire/somerandchar");
const builder = new somerandchar();

const result = builder.alphanum().size(64).toString();

console.log(result);

// lpQRGXWKmvN9DnCTRIgIcSPWWlm5SWgsTn_-rlfufMpTdadp3CveOsR9dULu2ZFd
// B5V_mijVumPf-62gVo6LIqx2UfQ8M7XEJKhAguDG6Xes5-81gXCJzSmhNg72cQ30

Customize somerandchar - With some other character sets

Pass a string to the customSet method any a preferred size, n to the size method.

const somerandchar = require("@otumian-empire/somerandchar");
const builder = new somerandchar();

const size = 16;
const charSet =
  "johnDOEu997uwt0tq5--z_(hz5m)un(7jp68(3)htuwlh__-psq5w1pDAnceMoney";

const result = builder.customSet(charSet).size(size).toString();

console.log(result);

// tsn_oqc_8tDup7Aj
// _w(59oD0pp190-ut

NOTE

  • The other in which size and, customSet, alphanum, alpha or alnum is called does not affect the output.
  • As mentioned or demonstrated, when size is not called the default value of size is 6 and when neither customSet, alphanum, alpha nor alnum is called, the default character set used is alnum.