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

rangerjs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rangerjs - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "rangerjs",
"version": "0.0.2",
"version": "0.0.3",
"description": "A lightweight JS library for defining an array of ranges.",

@@ -5,0 +5,0 @@ "main": "ranger.js",

@@ -6,4 +6,12 @@

var endBeforeStart = function(start, end) {
if (start - end > 0)
return true;
return false;
}
ranger.prototype = {
addRange: function(start, end) {
if (endBeforeStart(start, end))
return new Error('Start must be before end for range');
var index = null,

@@ -56,3 +64,16 @@ count = 0;

checkRange: function(start, end) {
if (endBeforeStart(start, end))
return new Error('Start must be before end for range');
for (var i=0; i < this.ranges.length; i+=2) {
if (this.ranges[i] <= start &&
this.ranges[i+1] >= end)
return true;
}
return false;
},
removeRange: function(start, end) {
if (endBeforeStart(start, end))
return new Error('Start must be before end for range');
for (var i=0; i < this.ranges.length; i+=2) {

@@ -59,0 +80,0 @@ if (this.ranges[i+1] >= start) {

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