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

insection

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

insection - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

insection.js

2

package.json
{
"name": "insection",
"version": "1.0.2",
"version": "1.0.3",
"description": "A data structure for storing number intervals",

@@ -5,0 +5,0 @@ "main": "lib/insection.js",

@@ -81,2 +81,26 @@ # Insection

### constructor
Creates a new insection instance.
Signature:
```js
new Insection(); => new Insection(defaultValueComparer);
new Insection(valueComparer);
```
where `defaultValueComparer` is:
```js
function defaultValueComparer(x, y) {
if (x < y) { return -1; }
if (x > y) { return 1; }
return 0;
}
```
Values is required to have a total order, if you values does not
support the comparison operators you can specify a valueComparer.
### add

@@ -91,6 +115,10 @@

insection.add(start, end, value) => insection.add('[', start, end, ']', value);
insection.add('[', start, end, ']', value) => insection.add(Insection.interval('[', start, end, ']'), value);
insection.add('[', start, end, ')', value) => insection.add(Insection.interval('[', start, end, ')'), value);
insection.add('(', start, end, ']', value) => insection.add(Insection.interval('(', start, end, ']'), value);
insection.add('(', start, end, ')', value) => insection.add(Insection.interval('(', start, end, ')'), value);
insection.add('[', start, end, ']', value) =>
insection.add(Insection.interval('[', start, end, ']'), value);
insection.add('[', start, end, ')', value) =>
insection.add(Insection.interval('[', start, end, ')'), value);
insection.add('(', start, end, ']', value) =>
insection.add(Insection.interval('(', start, end, ']'), value);
insection.add('(', start, end, ')', value) =>
insection.add(Insection.interval('(', start, end, ')'), value);
insection.add(interval, value);

@@ -150,6 +178,10 @@ ```

insection.getIntervals(start, end) => insection.getIntervals('[', start, end, ']');
insection.getIntervals('[', start, end, ']') => insection.getIntervals(Insection.interval('[', start, end, ']'));
insection.getIntervals('[', start, end, ')') => insection.getIntervals(Insection.interval('[', start, end, ')'));
insection.getIntervals('(', start, end, ']') => insection.getIntervals(Insection.interval('(', start, end, ']'));
insection.getIntervals('(', start, end, ')') => insection.getIntervals(Insection.interval('(', start, end, ')'));
insection.getIntervals('[', start, end, ']') =>
insection.getIntervals(Insection.interval('[', start, end, ']'));
insection.getIntervals('[', start, end, ')') =>
insection.getIntervals(Insection.interval('[', start, end, ')'));
insection.getIntervals('(', start, end, ']') =>
insection.getIntervals(Insection.interval('(', start, end, ']'));
insection.getIntervals('(', start, end, ')') =>
insection.getIntervals(Insection.interval('(', start, end, ')'));
insection.getIntervals(interval);

@@ -171,3 +203,7 @@ ```

expect(insection.getIntervals('(', -Infinity, 2, ')').map(String).sort(), 'to equal', ['[0;4]']);
expect(insection.getIntervals(2).map(String).sort(), 'to equal', ['[0;4]', '[2;Infinity)', '[2;Infinity)']);
expect(insection.getIntervals(2).map(String).sort(), 'to equal', [
'[0;4]',
'[2;Infinity)',
'[2;Infinity)'
]);
```

@@ -183,6 +219,10 @@ ### getEntries

insection.getEntries(start, end) => insection.getEntries('[', start, end, ']');
insection.getEntries('[', start, end, ']') => insection.getEntries(Insection.interval('[', start, end, ']'));
insection.getEntries('[', start, end, ')') => insection.getEntries(Insection.interval('[', start, end, ')'));
insection.getEntries('(', start, end, ']') => insection.getEntries(Insection.interval('(', start, end, ']'));
insection.getEntries('(', start, end, ')') => insection.getEntries(Insection.interval('(', start, end, ')'));
insection.getEntries('[', start, end, ']') =>
insection.getEntries(Insection.interval('[', start, end, ']'));
insection.getEntries('[', start, end, ')') =>
insection.getEntries(Insection.interval('[', start, end, ')'));
insection.getEntries('(', start, end, ']') =>
insection.getEntries(Insection.interval('(', start, end, ']'));
insection.getEntries('(', start, end, ')') =>
insection.getEntries(Insection.interval('(', start, end, ')'));
insection.getEntries(interval);

@@ -213,6 +253,10 @@ ```

insection.contains(start, end) => insection.contains('[', start, end, ']');
insection.contains('[', start, end, ']') => insection.contains(Insection.interval('[', start, end, ']'));
insection.contains('[', start, end, ')') => insection.contains(Insection.interval('[', start, end, ')'));
insection.contains('(', start, end, ']') => insection.contains(Insection.interval('(', start, end, ']'));
insection.contains('(', start, end, ')') => insection.contains(Insection.interval('(', start, end, ')'));
insection.contains('[', start, end, ']') =>
insection.contains(Insection.interval('[', start, end, ']'));
insection.contains('[', start, end, ')') =>
insection.contains(Insection.interval('[', start, end, ')'));
insection.contains('(', start, end, ']') =>
insection.contains(Insection.interval('(', start, end, ']'));
insection.contains('(', start, end, ')') =>
insection.contains(Insection.interval('(', start, end, ')'));
insection.contains(interval);

@@ -244,6 +288,10 @@ ```

insection.remove(start, end, value) => insection.remove('[', start, end, ']', value);
insection.remove('[', start, end, ']', value) => insection.remove(Insection.interval('[', start, end, ']'), value);
insection.remove('[', start, end, ')', value) => insection.remove(Insection.interval('[', start, end, ')'), value);
insection.remove('(', start, end, ']', value) => insection.remove(Insection.interval('(', start, end, ']'), value);
insection.remove('(', start, end, ')', value) => insection.remove(Insection.interval('(', start, end, ')'), value);
insection.remove('[', start, end, ']', value) =>
insection.remove(Insection.interval('[', start, end, ']'), value);
insection.remove('[', start, end, ')', value) =>
insection.remove(Insection.interval('[', start, end, ')'), value);
insection.remove('(', start, end, ']', value) =>
insection.remove(Insection.interval('(', start, end, ']'), value);
insection.remove('(', start, end, ')', value) =>
insection.remove(Insection.interval('(', start, end, ')'), value);
insection.remove(interval, value);

@@ -250,0 +298,0 @@ ```

Sorry, the diff of this file is not supported yet

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