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

interval-operations

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interval-operations - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

dist/main.js

@@ -1,1 +0,1 @@

"use strict";function sortByStart(r,n){return r[0]<n[0]?-1:r[0]>n[0]?1:0}function sortByEnd(r,n){return r[1]<n[1]?-1:r[1]>n[1]?1:0}function hasOverlap(r,n){return n[1]>r[0]&&n[0]<r[1]}function union(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(!r.length)return null;for(var t=[],e=(r=r.sort(sortByStart))[0],o=e[0],a=e[1],i=1,f=r.length;i<f;i++){var u=r[i],s=u[0],c=u[1];a<s&&(t.push([o,a]),o=s),a<c&&(a=c)}return t.concat([[o,a]])}function arrayUnion(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(!r.length)return[];for(var t=[],e=0,o=r.length;e<o;e++)t=t.concat(r[e]);return union.apply(void 0,t)}function difference(r,n){return hasOverlap(r,n)?n[0]>r[0]&&n[1]<r[1]?[[r[0],n[0]],[n[1],r[1]]]:n[0]<=r[0]&&n[1]>=r[1]?null:n[0]>r[0]?[[r[0],n[0]]]:[[n[1],r[1]]]:[r]}function arrayDifference(r,n){var t,e=union.apply(void 0,r),o=union.apply(void 0,n);if(!e)return[];if(!o)return e;for(var a=[],i=0,f=e.length;i<f;i++){for(var u=e[i],s=u[0],c=u[1],l=!0,v=0,h=o.length;v<h;v++){var y=o[v];if(!(y[1]<=s)){if(y[0]>=c)break;var p=difference([s,c],y);if(!p){l=!1;break}s=(t=p[p.length-1])[0],c=t[1],p.length>1&&a.push(p[0])}}l&&a.push([s,c])}return a}function intersection(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];r.sort(sortByStart);for(var t=[r[r.length-1][0],r.sort(sortByEnd)[0][1]],e=t[0],o=t[1],a=0,i=r.length;a<i-1;a++){var f=r[a+1],u=f[0],s=f[1];if(u>o||s<e)return null}return[e,o]}function arrayIntersection(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(var t=r[0],e=1,o=r.length;e<o;e++){var a=r[e];a.sort(sortByStart);for(var i=[],f=0,u=t.length;f<u;f++)for(var s=t[f],c=0,l=a.length;c<l;c++){var v=a[c];if(!(v[1]<=s[0])){if(v[0]>=s[1])break;i.push(intersection(s,v))}}t=i}return t.length?t:[]}function contains(r,n){return n[0]>=r[0]&&n[1]<=r[1]}function arrayContains(r,n){r=arrayUnion(r);for(var t=0,e=(n=arrayUnion(n)).length;t<e;t++){for(var o=!1,a=0,i=r.length;a<i;a++)if(contains(r[a],n[t])){o=!0;break}if(!o)return!1}return!0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayContains=arrayContains,exports.arrayDifference=arrayDifference,exports.arrayIntersection=arrayIntersection,exports.arrayUnion=arrayUnion,exports.contains=contains,exports.difference=difference,exports.intersection=intersection,exports.union=union;
"use strict";function sortByStart(r,n){return r[0]<n[0]?-1:r[0]>n[0]?1:0}function sortByEnd(r,n){return r[1]<n[1]?-1:r[1]>n[1]?1:0}function hasOverlap(r,n){return n[1]>r[0]&&n[0]<r[1]}function union(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(!r.length)return[];for(var t=[],e=(r=r.sort(sortByStart))[0],o=e[0],a=e[1],i=1,f=r.length;i<f;i++){var u=r[i],s=u[0],c=u[1];a<s&&(t.push([o,a]),o=s),a<c&&(a=c)}return t.concat([[o,a]])}function arrayUnion(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(!r.length)return[];for(var t=[],e=0,o=r.length;e<o;e++)t=t.concat(r[e]);return union.apply(void 0,t)}function difference(r,n){return hasOverlap(r,n)?n[0]>r[0]&&n[1]<r[1]?[[r[0],n[0]],[n[1],r[1]]]:n[0]<=r[0]&&n[1]>=r[1]?null:n[0]>r[0]?[[r[0],n[0]]]:[[n[1],r[1]]]:[r]}function arrayDifference(r,n){var t,e=union.apply(void 0,r),o=union.apply(void 0,n);if(!e)return[];if(!o)return e;for(var a=[],i=0,f=e.length;i<f;i++){for(var u=e[i],s=u[0],c=u[1],l=!0,v=0,h=o.length;v<h;v++){var y=o[v];if(!(y[1]<=s)){if(y[0]>=c)break;var p=difference([s,c],y);if(!p){l=!1;break}s=(t=p[p.length-1])[0],c=t[1],p.length>1&&a.push(p[0])}}l&&a.push([s,c])}return a}function intersection(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];r.sort(sortByStart);for(var t=[r[r.length-1][0],r.sort(sortByEnd)[0][1]],e=t[0],o=t[1],a=0,i=r.length;a<i-1;a++){var f=r[a+1],u=f[0],s=f[1];if(u>o||s<e)return null}return[e,o]}function arrayIntersection(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(var t=r[0],e=1,o=r.length;e<o;e++){var a=r[e];a.sort(sortByStart);for(var i=[],f=0,u=t.length;f<u;f++)for(var s=t[f],c=0,l=a.length;c<l;c++){var v=a[c];if(!(v[1]<=s[0])){if(v[0]>=s[1])break;i.push(intersection(s,v))}}t=i}return t.length?t:[]}function contains(r,n){return n[0]>=r[0]&&n[1]<=r[1]}function arrayContains(r,n){r=arrayUnion(r);for(var t=0,e=(n=arrayUnion(n)).length;t<e;t++){for(var o=!1,a=0,i=r.length;a<i;a++)if(contains(r[a],n[t])){o=!0;break}if(!o)return!1}return!0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayContains=arrayContains,exports.arrayDifference=arrayDifference,exports.arrayIntersection=arrayIntersection,exports.arrayUnion=arrayUnion,exports.contains=contains,exports.difference=difference,exports.intersection=intersection,exports.union=union;

@@ -1,1 +0,1 @@

function r(r,n){return r[0]<n[0]?-1:r[0]>n[0]?1:0}function n(r,n){return r[1]<n[1]?-1:r[1]>n[1]?1:0}function t(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];if(!n.length)return null;for(var e=[],f=(n=n.sort(r))[0],o=f[0],u=f[1],a=1,l=n.length;a<l;a++){var i=n[a],h=i[0],v=i[1];u<h&&(e.push([o,u]),o=h),u<v&&(u=v)}return e.concat([[o,u]])}function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(!r.length)return[];for(var e=[],f=0,o=r.length;f<o;f++)e=e.concat(r[f]);return t.apply(void 0,e)}function f(r,n){return function(r,n){return n[1]>r[0]&&n[0]<r[1]}(r,n)?n[0]>r[0]&&n[1]<r[1]?[[r[0],n[0]],[n[1],r[1]]]:n[0]<=r[0]&&n[1]>=r[1]?null:n[0]>r[0]?[[r[0],n[0]]]:[[n[1],r[1]]]:[r]}function o(r,n){var e,o=t.apply(void 0,r),u=t.apply(void 0,n);if(!o)return[];if(!u)return o;for(var a=[],l=0,i=o.length;l<i;l++){for(var h=o[l],v=h[0],g=h[1],c=!0,p=0,s=u.length;p<s;p++){var b=u[p];if(!(b[1]<=v)){if(b[0]>=g)break;var k=f([v,g],b);if(!k){c=!1;break}v=(e=k[k.length-1])[0],g=e[1],k.length>1&&a.push(k[0])}}c&&a.push([v,g])}return a}function u(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t.sort(r);for(var f=[t[t.length-1][0],t.sort(n)[0][1]],o=f[0],u=f[1],a=0,l=t.length;a<l-1;a++){var i=t[a+1],h=i[0],v=i[1];if(h>u||v<o)return null}return[o,u]}function a(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];for(var e=n[0],f=1,o=n.length;f<o;f++){var a=n[f];a.sort(r);for(var l=[],i=0,h=e.length;i<h;i++)for(var v=e[i],g=0,c=a.length;g<c;g++){var p=a[g];if(!(p[1]<=v[0])){if(p[0]>=v[1])break;l.push(u(v,p))}}e=l}return e.length?e:[]}function l(r,n){return n[0]>=r[0]&&n[1]<=r[1]}function i(r,n){r=e(r);for(var t=0,f=(n=e(n)).length;t<f;t++){for(var o=!1,u=0,a=r.length;u<a;u++)if(l(r[u],n[t])){o=!0;break}if(!o)return!1}return!0}export{i as arrayContains,o as arrayDifference,a as arrayIntersection,e as arrayUnion,l as contains,f as difference,u as intersection,t as union};
function r(r,n){return r[0]<n[0]?-1:r[0]>n[0]?1:0}function n(r,n){return r[1]<n[1]?-1:r[1]>n[1]?1:0}function t(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];if(!n.length)return[];for(var e=[],f=(n=n.sort(r))[0],o=f[0],u=f[1],a=1,l=n.length;a<l;a++){var i=n[a],h=i[0],v=i[1];u<h&&(e.push([o,u]),o=h),u<v&&(u=v)}return e.concat([[o,u]])}function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(!r.length)return[];for(var e=[],f=0,o=r.length;f<o;f++)e=e.concat(r[f]);return t.apply(void 0,e)}function f(r,n){return function(r,n){return n[1]>r[0]&&n[0]<r[1]}(r,n)?n[0]>r[0]&&n[1]<r[1]?[[r[0],n[0]],[n[1],r[1]]]:n[0]<=r[0]&&n[1]>=r[1]?null:n[0]>r[0]?[[r[0],n[0]]]:[[n[1],r[1]]]:[r]}function o(r,n){var e,o=t.apply(void 0,r),u=t.apply(void 0,n);if(!o)return[];if(!u)return o;for(var a=[],l=0,i=o.length;l<i;l++){for(var h=o[l],v=h[0],g=h[1],c=!0,p=0,s=u.length;p<s;p++){var b=u[p];if(!(b[1]<=v)){if(b[0]>=g)break;var k=f([v,g],b);if(!k){c=!1;break}v=(e=k[k.length-1])[0],g=e[1],k.length>1&&a.push(k[0])}}c&&a.push([v,g])}return a}function u(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t.sort(r);for(var f=[t[t.length-1][0],t.sort(n)[0][1]],o=f[0],u=f[1],a=0,l=t.length;a<l-1;a++){var i=t[a+1],h=i[0],v=i[1];if(h>u||v<o)return null}return[o,u]}function a(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];for(var e=n[0],f=1,o=n.length;f<o;f++){var a=n[f];a.sort(r);for(var l=[],i=0,h=e.length;i<h;i++)for(var v=e[i],g=0,c=a.length;g<c;g++){var p=a[g];if(!(p[1]<=v[0])){if(p[0]>=v[1])break;l.push(u(v,p))}}e=l}return e.length?e:[]}function l(r,n){return n[0]>=r[0]&&n[1]<=r[1]}function i(r,n){r=e(r);for(var t=0,f=(n=e(n)).length;t<f;t++){for(var o=!1,u=0,a=r.length;u<a;u++)if(l(r[u],n[t])){o=!0;break}if(!o)return!1}return!0}export{i as arrayContains,o as arrayDifference,a as arrayIntersection,e as arrayUnion,l as contains,f as difference,u as intersection,t as union};
import { Interval } from './types';
export declare function union(...intervals: Interval[]): Interval[] | null;
export declare function union(...intervals: Interval[]): Interval[];
export declare function arrayUnion(...arrays: Interval[][]): Interval[];
{
"name": "interval-operations",
"version": "1.0.2",
"version": "1.0.3",
"description": "Utilities for performing mathematical set operations on intervals and arrays of intervals",

@@ -5,0 +5,0 @@ "keywords": [

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