Package detail

ranges-sort

codsen652.2kMIT6.0.13

Sort string index ranges

array, indexes, ranges, sort

readme

ranges-sort

Sort string index ranges

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 4.1.0 (npm i ranges-sort@4.1.0).

npm i ranges-sort

Quick Take

import { strict as assert } from "assert";

import { rSort } from "ranges-sort";

// Ranges (see codsen.com/ranges/) are sorted:
assert.deepEqual(
  rSort([
    [2, 3],
    [9, 10, "bad grey wolf"],
    [1, 2],
  ]),
  [
    [1, 2],
    [2, 3],
    [9, 10, "bad grey wolf"],
  ],
);

Documentation

Please visit codsen.com for a full description of the API.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License.

Copyright © 2010-2025 Roy Revelt and other contributors.

ok codsen star

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

6.0.0 (2022-12-01)

BREAKING CHANGES

  • Minimum supported Node version is v14.18; we're dropping v12 support

5.1.0 (2022-08-12)

Features

5.0.0 (2021-09-09)

Features

BREAKING CHANGES

  • programs now are in ES Modules and won't work with Common JS require()

4.1.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

4.0.15 (2021-04-11)

Reverts

  • Revert "chore: setup refresh" (23cf206)

4.0.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

4.0.0 (2021-01-23)

Features

  • rewrite in TS and start using named exports (353f021)

BREAKING CHANGES

  • previously: import rsort from ... - now import { rSort } from ...

3.14.0 (2020-11-28)

Accidental version bump during migration to SourceHut. Sorry about that.

3.13.0 (2020-09-07)

Features

  • discard any nulls among the ranges (5f86fbc)

3.12.0 (2020-05-24)

Features

  • don't throw error if input is not array or it's empty - just quickly return it (e169a87)

3.11.0 (2020-02-01)

Features

  • remove all dependencies (3c8fda8)

3.10.39 (2019-10-02)

Performance Improvements

  • remove orginal number package and check-types-mini, make 165 times faster (6e995c5)

3.10.0 (2019-01-20)

  • Various documentation and setup tweaks after we migrated to monorepo
  • Setup refresh: updated dependencies and all config files using automated tools

3.6.0 (2018-12-26)

3.5.0 (2018-11-29)

  • Add opts.progressFn - if you pass a function, it will report the progress, calling that function with a number between 0 and 100. It's not precise and meant to be used as an approximate progress indicator.

3.4.0 (2018-10-25)

  • Updated all dependencies
  • Restored coveralls.io reporting
  • Restored unit test linting

3.3.0 (2018-06-11)

GitHub sold us out. In the meantime, we:

  • Migrated to BitBucket (to host repo + perform CI) and Codacy (for code quality audit)
  • Dropped BitHound (RIP) and Travis
  • Removed package-lock

3.2.0 (2018-05-26)

  • Set up Prettier on a custom ESLint rule set.
  • Removed package.lock and .editorconfig
  • Wired Rollup to remove comments from non-dev builds. This means we can now leave the console.logs in the source code — there's no need to comment-out console.log statements or care about them not spilling into production. Now it's done automatically.
  • Unit tests are pointing at ES modules build, which means that code coverage is correct now, without Babel functions being missed. This is important because now code coverage is real again and now there are no excuses not to perfect it.

3.1.0 (2018-01-10)

  • Updated all dependencies and setup in general

3.0.0 (2017-12-03)

  • Set up Rollup, generating three builds: CommonJS, UMD and ES Modules
  • Rebase the code to be natively in ES Modules

PS. Bumping major just in case this breaks API endpoints.

2.1.0 (2017-09-13)

  • Add more description in readme
  • Add more unit tests, including tests for examples used in readme

2.0.0 (2017-09-12)

  • Add opts.strictlyTwoElementsInRangeArrays (default is false, differently from v1 which is opposite)

1.0.0 (2017-09-11)

  • Initial release