Skip to content
Add, remove, print from a collection of numeric ranges
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src
test
.babelrc
.editorconfig
.eslintignore
.eslintrc
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
package.json

README.md

RangeCollection

Build Status Coverage Status Issues dependencies Status devDependencies Status License: MIT Downloads

A RangeCollection class manages a collection of numeric ranges.

Given, a Range is a pair of integers for example: [1, 5). This range includes integers: 1, 2, 3, and 4.

Installation

Use the package manager npm to install RangeCollection.

Commands

  • npm install - Install dependencies
  • npm run clean - Remove lib/ directory
  • npm test - Run tests with linting and coverage results.
  • npm run test:examples - Test written examples on pure JS for better understanding module usage.
  • npm run lint - Run ESlint with airbnb-config
  • npm run cover - Get coverage report for your code.
  • npm run build - Babel will transpile ES6 => ES5 and minify the code.

Usage

const RangeCollection = require('./RangeCollection');

const range = new RangeCollection();

range.add([10, 100])
range.print();
// '[10, 100)'

range.add([200, 300])
range.print();
// '[10, 100) [200, 300)'

range.remove([40, 50])
range.print();
// '[10, 40) [50, 100) [200, 300)'

License

MIT © Ankush Mehta

You can’t perform that action at this time.