JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1142417
  • Score
    100M100P100Q189120F
  • License MIT

For adding, subtracting, and indexing discontinuous ranges of numbers

Package Exports

  • drange

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (drange) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

drange

For adding/subtracting sets of range of numbers.

Build Status Dependency Status codecov

Usage

const DRange = require('drange');

var allNums = new DRange(1, 100); //[ 1-100 ]
var badNums = DRange(13).add(8).add(60,80); //[8, 13, 60-80]
var goodNums = allNums.clone().subtract(badNums);
console.log(goodNums.toString()); //[ 1-7, 9-12, 14-59, 81-100 ]
var randomGoodNum = goodNums.index(Math.floor(Math.random() * goodNums.length));

Install

npm install drange

Tests

Tests are written with mocha

npm test