JSPM

discontinuous-range

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

for adding, subtracting, and indexing discontinuous ranges of numbers

Package Exports

  • discontinuous-range
  • discontinuous-range/index.js

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 (discontinuous-range) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

discontinuous-range

DiscontinuousRange(1, 10).subtract(4, 6); // [ 1-3, 7-10 ]

this is a pretty simple module, but it exists to service another project so this'll be pretty lacking documentation. reading the test to see how this works may help. otherwise, here's an example that I think pretty much sums it up

Example

var all_numbers = new DiscontinuousRange(1, 100); //[ 1-100 ]
var bad_numbers = DiscontinuousRange(13).add(8).add(60,80); //[8, 13, 60-80]
var good_numbers = all_numbers.clone().subtract(bad_numbers);
console.log(good_numbers.toString()); //[ 1-7, 9-12, 14-59, 81-100 ]
var random_good_number = good_numbers.index(Math.floor(Math.random() * good_numbers.length));