Skip to content

Commit

Permalink
Adds usage in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankush Mehta committed Feb 13, 2019
1 parent 52cb69d commit 72ddfd6
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# RangeCollection
[![Build Status](https://travis-ci.org/nkshio/RangeCollection.svg?branch=master)](https://travis-ci.org/nkshio/RangeCollection) [![Coverage Status](https://coveralls.io/repos/nkshio/RangeCollection/badge.svg?branch=master)](https://coveralls.io/r/nkshio/RangeCollection?branch=master) [![Issues](https://img.shields.io/github/issues/nkshio/RangeCollection.svg)](https://github.com/nkshio/RangeCollection/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) [![Downloads](https://img.shields.io/npm/dt/@nkshio/rangecollection.svg)](https://www.npmjs.com/package/@nkshio/rangecollection) [![dependencies Status](https://david-dm.org/nkshio/RangeCollection/status.svg)](https://david-dm.org/nkshio/RangeCollection) [![devDependencies Status](https://david-dm.org/nkshio/RangeCollection/dev-status.svg)](https://david-dm.org/nkshio/RangeCollection?type=dev) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Build Status](https://travis-ci.org/nkshio/RangeCollection.svg?branch=master)](https://travis-ci.org/nkshio/RangeCollection) [![Coverage Status](https://coveralls.io/repos/nkshio/RangeCollection/badge.svg?branch=master)](https://coveralls.io/r/nkshio/RangeCollection?branch=master) [![Issues](https://img.shields.io/github/issues/nkshio/RangeCollection.svg)](https://github.com/nkshio/RangeCollection/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) [![dependencies Status](https://david-dm.org/nkshio/RangeCollection/status.svg)](https://david-dm.org/nkshio/RangeCollection) [![devDependencies Status](https://david-dm.org/nkshio/RangeCollection/dev-status.svg)](https://david-dm.org/nkshio/RangeCollection?type=dev) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Downloads](https://img.shields.io/npm/dt/@nkshio/rangecollection.svg)](https://www.npmjs.com/package/@nkshio/rangecollection)

This Implements a `RangeCollection` class.

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

A `RangeCollection` is an aggregate of these ranges.
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

Expand All @@ -21,5 +18,25 @@ Use the package manager [npm](https://www.npmjs.com/) to install `RangeCollectio
- `npm run cover` - Get coverage report for your code.
- `npm run build` - Babel will transpile ES6 => ES5 and minify the code.

## Usage
```javascript
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

0 comments on commit 72ddfd6

Please sign in to comment.