New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

natural-range

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

natural-range

Convert any range to an exclusive range in natural order.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53
increased by231.25%
Maintainers
1
Weekly downloads
 
Created
Source

natural-range

Convert any range to an exclusive range in natural order.

Installation

npm install natural-range

Example

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

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

Keywords

FAQs

Package last updated on 23 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc