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

rndstr

v1.0.0

Published

Generate random string

Downloads

2,554

Readme

rndstr.js

Generate random string

Install

$ npm install rndstr --save

Usage

rndstr(opts)

Example

const rndstr = require('rndstr');

rndstr(); // ujvb17u5vxgqsh41mgwhlo3lfjrbz1xy2oi9zgxk7vh04r5p3cfc121fo8bkoj2j
rndstr(); // 9rx8ghughdlihe35l7uzld4f3gvwa0wm0cb21ousiiit7q2uvrixo331zcdkb8kj
rndstr(); // q1a334oio0t6sc5yqb2yjqmuym22acthfzhsnwrr67orp5hvjkj22r9fiehonly9

// === Use custom options ===
rndstr({length: 8, chars: '0-9'}); // 51048708
rndstr({length: 8, chars: '0-9'}); // 80987908
rndstr({length: 8, chars: '0-9'}); // 72556885

// === Specify seed ===
rndstr({seed: 'himawari'}); // Always m8ucpxibnp98qd8791hv98h1knfdypimztyfo3agu7gj757uyicjdea8wwyrpwab
rndstr({seed: 'sakurako'}); // Always kybaq23mek8580s246kjkngupc9zsuyjuqgh6jkbale5btvtzssxjn2g6nienuyq

// === Enable/Disable range-syntax parser ===
rndstr({length: 16, chars: 'a-z', parseRange: true}); // sbywqwriyielxske
rndstr({length: 16, chars: 'a-z', parseRange: false}); // az--a--zaa-a-aa-

Options

| Property | Type | Description | Default | | :------------- | :--------------------- | :--------------------------------------------------------- | :--------- | | length | number | The length of your resulting string | 64 | | chars | string or string[] | The chars you want to include | 'a-z0-9' | | seed | string or number | The seed value to be used to generate | null | | parseRange | boolean | Whether a given chars be interpreted as a range-syntax | true |

On TypeScript

Type definition are bundled.

import rndstr from 'rndstr';

License

MIT