Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

range-utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

range-utils

Utilities to manipulate ranges

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

range-utils

Javascript utilities to work with ranges. A range is an object with a least two property: offset and length.

Build Status NPM version

Installation

$ npm install range-utils

Usage

// Initialize a range

var from0To10 = Range(0, 10);
var from5To20 = Range(5, 15);
var withProperty = Range(0, 10, { hello: 'world' });

// Check if a range contains another range
Range.contains(
    Range(0, 10),
    Range(5, 2)
);

// Check that two ranges are collapsing
Range.areCollapsing(
    Range(0, 10),
    Range(9, 10)
);

// Translate a range
Range.moveBy(a, 10);

// Enlarge a range
Range.enlarge(a, 10);

FAQs

Package last updated on 07 Apr 2016

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