Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsrange

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsrange

An extremely simple range lib, for expanding "1..3,5..7"-like strings into [1, 2, 3, 5, 6, 7]

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

jsrange Build Status

An extremely simple range lib, for expanding "1..3,5..7"-like strings into [1, 2, 3, 5, 6, 7]

Install

npm install --save jsrange

Examples

var range = require('jsrange');

// Every even number from 2 to 100:
range("2 .. 100 x 2");

// -20 to 30, stepping by 3 each time:
range("-20 .. 30 x 3");

// 2, 10, and 11:
range("2, 10, 11");

// 20 down to 12, then 12 back to 20 by 3s:
range("20 .. 12, 12 .. 20 x 3");

Specifics on Syntax

  • You have any number of ,-deliminated sections. Each section will be represented in the result, in order.
  • Each section should be one of these types:
    • A single value.
      (eg: "5" or "-20".)
    • A start and an end value separated by ...
      (eg: "1..42" or "7 .. -13")
    • A start and an end value separated by .., with a positive step value after a x.
      (eg: "1 .. 10 x 3" or "22 .. -13 x 5")

License

MIT

Keywords

FAQs

Package last updated on 25 Nov 2014

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