JSPM

  • Created
  • Published
  • Downloads 242141
  • Score
    100M100P100Q167803F
  • License MIT

Sort natural number index ranges [ [5, 6], [1, 3] ] => [ [1, 3], [5, 6] ]

Package Exports

  • ranges-sort

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

Readme

ranges-sort

Sort natural number index ranges [ [5, 6], [1, 3] ] => [ [1, 3], [5, 6] ]

Link to npm page bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies Coverage Status Known Vulnerabilities Downloads/Month View dependencies as 2D chart Test in browser

Install

$ npm install --save ranges-sort
const rangesSort = require('ranges-sort')

We are serving code transpiled down to ES5.

Table of Contents

Rationale

API

Input: Array of zero or more arrays meaning natural number ranges (2 elements each). This package does not mutate the input array.

For example,

[ [5, 9], [5, 3] ] => [ [5, 3], [5, 9] ]

Output: Sorted input array. First, we sort by the first argument of each child range array, then by second.

Contributing & testing

If you want to contribute, don't hesitate. If it's a code contribution, please supplement test.js with tests covering your code. This library uses airbnb-base rules preset of eslint with two exceptions^ and follows the Semver rules.

^ 1. No semicolons. 2. Allow plus-plus in for loops. See ./eslintrc

Licence

MIT License (MIT)

Copyright (c) 2017 Codsen Ltd, Roy Revelt

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.