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

infinite-sequence-generator

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

infinite-sequence-generator

An infinte set of keys that never ends, never repeats, is somewhat human readble and scales logarythmically.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Infinite Key Generator

Creates a sequence of strings that can be compared by > and < operators (and therefore sort). The sequence never ends (doesn't overflow like a number at 2^52) and the memory footprint scales logarithimcally.

How it works

Well it returns a generator that's yields a sequence of keys of all printable ASCII 7-bit character set and uses that set as digits.

Install dependency from npm

npm install infinite-sequence-generator

Then use it in the code as you like it:

    const fini = require("infinite-sequence-generator");

    const seq = fini();
    seq.next().value;   // __!

    // or maybe as an iterator

    let i = 0;
    for (var key of seq) {
        console.log(key);
        if (i++ > 10) break;
    }

You may add a sequence prefix if you like.

    const seq = fini("AAA__");

    console.log(seq.next().value); // AAA__!

You can add your own alphabet:

    const seq = fini("-prefix-", '0123456789abcdef');

    console.log(seq.next().value); // AAA__!

License and contributions

MIT Licensed, see LICENSE file.

FAQs

Package last updated on 08 Jan 2018

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