# natural-range

> Convert any range to an exclusive range in natural order.

Latest version **1.0.0** (published 2013-08-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install natural-range
pnpm add natural-range
yarn add natural-range
bun add natural-range
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2013-08-23 |
| First published | 2013-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Glen Huang |
| Maintainers | curvedmark |
| Keywords | range, sort, util, utility |

## Links

- npm: https://www.npmjs.com/package/natural-range
- Repository: https://github.com/curvedmark/natural-range
- Issues: https://github.com/curvedmark/natural-range/issues
- npm.io page: https://npm.io/package/natural-range

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2013-08-23

## README

# natural-range

Convert any range to an exclusive range in natural order.

## Installation

	npm install natural-range

## Example

```javascript
var assert = require('assert');
var Range = require('natural-range');

var range = new Range({ from: 3, to: 1 });

assert.equal(range.from, 1);
assert.equal(range.to, 4);
assert.equal(range.reversed, true);
```

See `test/test.js` for more examples.

## API

```javascript
var range = new Range(options);
```

* `options` - an object literal supports these options:
	* `from` - the start number
	* `to` - the end number
	* `exclusive` - a boolean denoting if the range is exclusive
	* `length` - if `from` or `to` is negative, and this option is provided, the negative number means backwards indexing and is relative to `length`

* `range` - the range object in natural order containing these properties:
	* `from` - the start number
	* `to` - the end number
	* `reversed` - a boolean denoting if the original range is in reversed order

---
_Source: https://npm.io/package/natural-range · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
