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

ranges-merge

Package Overview
Dependencies
Maintainers
1
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ranges-merge - npm Package Compare versions

Comparing version 9.0.14 to 9.0.15

4

dist/ranges-merge.esm.js
/**
* @name ranges-merge
* @fileoverview Merge and sort string index ranges
* @version 9.0.14
* @version 9.0.15
* @author Roy Revelt, Codsen Ltd

@@ -10,3 +10,3 @@ * @license MIT

import{rSort as p}from"ranges-sort";var u="9.0.14";var y=u,d={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function b(i,r){function l(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}if(!Array.isArray(i)||!i.length)return null;let n;if(r)if(l(r)){if(n={...d,...r},n.progressFn&&l(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof n.progressFn}", equal to ${JSON.stringify(n.progressFn,null,4)}`);if(![1,2,"1","2"].includes(n.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof n.mergeType}", equal to ${JSON.stringify(n.mergeType,null,4)}`);if(typeof n.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof n.joinRangesThatTouchEdges}", equal to ${JSON.stringify(n.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
import{rSort as p}from"ranges-sort";var u="9.0.15";var y=u,d={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function b(i,r){function l(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}if(!Array.isArray(i)||!i.length)return null;let n;if(r)if(l(r)){if(n={...d,...r},n.progressFn&&l(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof n.progressFn}", equal to ${JSON.stringify(n.progressFn,null,4)}`);if(![1,2,"1","2"].includes(n.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof n.mergeType}", equal to ${JSON.stringify(n.mergeType,null,4)}`);if(typeof n.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof n.joinRangesThatTouchEdges}", equal to ${JSON.stringify(n.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
${JSON.stringify(r,null,4)} (type ${typeof r})`);else n={...d};let g=i.filter(e=>Array.isArray(e)).map(e=>[...e]).filter(e=>e[2]!==void 0||e[0]!==e[1]),s,o,t;n.progressFn?s=p(g,{progressFn:e=>{t=Math.floor(e/5),t!==o&&(o=t,n.progressFn(t))}}):s=p(g);let a=s.length-1;for(let e=a;e>0;e--)n.progressFn&&(t=Math.floor((1-e/a)*78)+21,t!==o&&t>o&&(o=t,n.progressFn(t))),(s[e][0]<=s[e-1][0]||!n.joinRangesThatTouchEdges&&s[e][0]<s[e-1][1]||n.joinRangesThatTouchEdges&&s[e][0]<=s[e-1][1])&&(s[e-1][0]=Math.min(s[e][0],s[e-1][0]),s[e-1][1]=Math.max(s[e][1],s[e-1][1]),s[e][2]!==void 0&&(s[e-1][0]>=s[e][0]||s[e-1][1]<=s[e][1])&&s[e-1][2]!==null&&(s[e][2]===null&&s[e-1][2]!==null?s[e-1][2]=null:s[e-1][2]!=null?+n.mergeType==2&&s[e-1][0]===s[e][0]?s[e-1][2]=s[e][2]:s[e-1][2]+=s[e][2]:s[e-1][2]=s[e][2]),s.splice(e,1),e=s.length);return s.length?s:null}export{d as defaults,b as rMerge,y as version};
/**
* @name ranges-merge
* @fileoverview Merge and sort string index ranges
* @version 9.0.14
* @version 9.0.15
* @author Roy Revelt, Codsen Ltd

@@ -10,3 +10,3 @@ * @license MIT

"use strict";var rangesMerge=(()=>{var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var f=(r,t,i)=>t in r?p(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i,u=(r,t)=>{for(var i in t||(t={}))y.call(t,i)&&f(r,i,t[i]);if(c)for(var i of c(t))R.call(t,i)&&f(r,i,t[i]);return r};var T=(r,t)=>{for(var i in t)p(r,i,{get:t[i],enumerable:!0})},w=(r,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of b(t))!y.call(r,a)&&a!==i&&p(r,a,{get:()=>t[a],enumerable:!(s=h(t,a))||s.enumerable});return r};var E=r=>w(p({},"__esModule",{value:!0}),r);var F={};T(F,{defaults:()=>m,rMerge:()=>D,version:()=>v});var j={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function d(r,t){if(!Array.isArray(r)||!r.length)return r;let i=u(u({},j),t),s,a;if(i.strictlyTwoElementsInRangeArrays&&!r.every((o,l)=>!Array.isArray(o)||o.length!==2?(s=l,a=o.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${s}th range (${JSON.stringify(r[s],null,4)}) has not two but ${a} elements!`);if(!r.every((o,l)=>!Array.isArray(o)||!Number.isInteger(o[0])||o[0]<0||!Number.isInteger(o[1])||o[1]<0?(s=l,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${s}th range (${JSON.stringify(r[s],null,4)}) does not consist of only natural numbers!`);let n=r.length**2,g=0;return Array.from(r).sort((o,l)=>(i.progressFn&&(g+=1,i.progressFn(Math.floor(g*100/n))),o[0]===l[0]?o[1]<l[1]?-1:o[1]>l[1]?1:0:o[0]<l[0]?-1:1))}var $="9.0.14";var v=$,m={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function D(r,t){function i(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}if(!Array.isArray(r)||!r.length)return null;let s;if(t)if(i(t)){if(s=u(u({},m),t),s.progressFn&&i(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof s.progressFn}", equal to ${JSON.stringify(s.progressFn,null,4)}`);if(![1,2,"1","2"].includes(s.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof s.mergeType}", equal to ${JSON.stringify(s.mergeType,null,4)}`);if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof s.joinRangesThatTouchEdges}", equal to ${JSON.stringify(s.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
"use strict";var rangesMerge=(()=>{var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var f=(r,t,i)=>t in r?p(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i,u=(r,t)=>{for(var i in t||(t={}))y.call(t,i)&&f(r,i,t[i]);if(c)for(var i of c(t))R.call(t,i)&&f(r,i,t[i]);return r};var T=(r,t)=>{for(var i in t)p(r,i,{get:t[i],enumerable:!0})},w=(r,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of b(t))!y.call(r,a)&&a!==i&&p(r,a,{get:()=>t[a],enumerable:!(s=h(t,a))||s.enumerable});return r};var E=r=>w(p({},"__esModule",{value:!0}),r);var F={};T(F,{defaults:()=>m,rMerge:()=>D,version:()=>v});var j={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function d(r,t){if(!Array.isArray(r)||!r.length)return r;let i=u(u({},j),t),s,a;if(i.strictlyTwoElementsInRangeArrays&&!r.every((o,l)=>!Array.isArray(o)||o.length!==2?(s=l,a=o.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${s}th range (${JSON.stringify(r[s],null,4)}) has not two but ${a} elements!`);if(!r.every((o,l)=>!Array.isArray(o)||!Number.isInteger(o[0])||o[0]<0||!Number.isInteger(o[1])||o[1]<0?(s=l,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${s}th range (${JSON.stringify(r[s],null,4)}) does not consist of only natural numbers!`);let n=r.length**2,g=0;return Array.from(r).sort((o,l)=>(i.progressFn&&(g+=1,i.progressFn(Math.floor(g*100/n))),o[0]===l[0]?o[1]<l[1]?-1:o[1]>l[1]?1:0:o[0]<l[0]?-1:1))}var $="9.0.15";var v=$,m={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function D(r,t){function i(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}if(!Array.isArray(r)||!r.length)return null;let s;if(t)if(i(t)){if(s=u(u({},m),t),s.progressFn&&i(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof s.progressFn}", equal to ${JSON.stringify(s.progressFn,null,4)}`);if(![1,2,"1","2"].includes(s.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof s.mergeType}", equal to ${JSON.stringify(s.mergeType,null,4)}`);if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof s.joinRangesThatTouchEdges}", equal to ${JSON.stringify(s.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
${JSON.stringify(t,null,4)} (type ${typeof t})`);else s=u({},m);let a=r.filter(e=>Array.isArray(e)).map(e=>[...e]).filter(e=>e[2]!==void 0||e[0]!==e[1]),n,g,o;s.progressFn?n=d(a,{progressFn:e=>{o=Math.floor(e/5),o!==g&&(g=o,s.progressFn(o))}}):n=d(a);let l=n.length-1;for(let e=l;e>0;e--)s.progressFn&&(o=Math.floor((1-e/l)*78)+21,o!==g&&o>g&&(g=o,s.progressFn(o))),(n[e][0]<=n[e-1][0]||!s.joinRangesThatTouchEdges&&n[e][0]<n[e-1][1]||s.joinRangesThatTouchEdges&&n[e][0]<=n[e-1][1])&&(n[e-1][0]=Math.min(n[e][0],n[e-1][0]),n[e-1][1]=Math.max(n[e][1],n[e-1][1]),n[e][2]!==void 0&&(n[e-1][0]>=n[e][0]||n[e-1][1]<=n[e][1])&&n[e-1][2]!==null&&(n[e][2]===null&&n[e-1][2]!==null?n[e-1][2]=null:n[e-1][2]!=null?+s.mergeType==2&&n[e-1][0]===n[e][0]?n[e-1][2]=n[e][2]:n[e-1][2]+=n[e][2]:n[e-1][2]=n[e][2]),n.splice(e,1),e=n.length);return n.length?n:null}return E(F);})();

@@ -13,0 +13,0 @@ /**

{
"name": "ranges-merge",
"version": "9.0.14",
"version": "9.0.15",
"description": "Merge and sort string index ranges",

@@ -73,8 +73,8 @@ "keywords": [

"dependencies": {
"ranges-push": "^7.0.14",
"ranges-push": "^7.0.15",
"ranges-sort": "^6.0.11"
},
"devDependencies": {
"rfdc": "^1.3.0"
"rfdc": "^1.3.1"
}
}
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