Socket
Socket
Sign inDemoInstall

shortest

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shortest

given an input character set, create an iterator function that returns the next shortest string available


Version published
Maintainers
1
Created
Source

shortest


var counter = require('shortest')('abcdefg'.split(''))

for(var i = 0, len = 100; i < len; ++i) {
  process.stdout.write(counter()+' ')
}

/* output:

a b c d e f g ba bb bc bd be bf bg ca cb cc cd ce cf cg da db dc dd de df dg ea eb ec ed ee ef eg fa fb fc fd fe ff fg ga gb gc gd ge gf gg baa bab bac bad bae baf bag bba bbb bbc bbd bbe bbf bbg bca bcb bcc bcd bce bcf bcg bda bdb bdc bdd bde bdf bdg bea beb bec bed bee bef beg bfa bfb bfc bfd bfe bff bfg bga bgb bgc bgd bge bgf bgg caa cab

*/

Create a counter function that iterates through a provided space of characters.

api

counter = require('shortest')([character set])

create a counter function.

counter() -> string

return the next item in the sequence

counter.pos() -> position

return the current position in the sequence

counter.skip(N) -> position

skip N items and return the new position

counter.reset() -> 0

return counter to 0

license

MIT

Keywords

FAQs

Package last updated on 24 Nov 2012

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