ranges-process-outside 6.0.6 → 6.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name ranges-process-outside
3
3
  * @fileoverview Iterate string considering ranges, as if they were already applied
4
- * @version 6.0.6
4
+ * @version 6.0.7
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ranges-process-outside/}
8
8
  */
9
9
 
10
- import f from"runes";import{rInvert as g}from"ranges-invert";import{rCrop as y}from"ranges-crop";var u="6.0.6";var E=u;function D(e,t,r,i=!1){if(typeof e!="string")throw e===void 0?new Error("ranges-process-outside: [THROW_ID_01] the first input argument must be string! It's missing currently (undefined)!"):new Error(`ranges-process-outside: [THROW_ID_02] the first input argument must be string! It was given as:
10
+ import f from"runes";import{rInvert as g}from"ranges-invert";import{rCrop as y}from"ranges-crop";var u="6.0.7";var E=u;function D(e,t,r,i=!1){if(typeof e!="string")throw e===void 0?new Error("ranges-process-outside: [THROW_ID_01] the first input argument must be string! It's missing currently (undefined)!"):new Error(`ranges-process-outside: [THROW_ID_02] the first input argument must be string! It was given as:
11
11
  ${JSON.stringify(e,null,4)} (type ${typeof e})`);if(t&&(!Array.isArray(t)||t.length&&!Array.isArray(t[0])))throw new Error(`ranges-process-outside: [THROW_ID_03] the second input argument must be array of ranges or null! It was given as:
12
12
  ${JSON.stringify(t,null,4)} (type ${typeof t})`);if(typeof r!="function")throw new Error(`ranges-process-outside: [THROW_ID_04] the third input argument must be a function! It was given as:
13
13
  ${JSON.stringify(r,null,4)} (type ${typeof r})`);function l(n,c){(c||[]).forEach(([d,m])=>{for(let s=d;s<m;s++){let o=f(n.slice(s))[0].length;r(s,s+o,p=>{p!=null&&(s+=p)}),o&&o>1&&(s+=o-1)}})}if(t?.length){let n=y(g(t,e.length,{skipChecks:!!i}),e.length);l(e,n)}else l(e,[[0,e.length]])}export{D as rProcessOutside,E as version};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @name ranges-process-outside
3
3
  * @fileoverview Iterate string considering ranges, as if they were already applied
4
- * @version 6.0.6
4
+ * @version 6.0.7
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ranges-process-outside/}
@@ -9,14 +9,14 @@
9
9
 
10
10
  "use strict";var rangesProcessOutside=(()=>{var C=Object.create;var c=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols,W=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var O=(e,r,s)=>r in e?c(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,f=(e,r)=>{for(var s in r||(r={}))E.call(r,s)&&O(e,s,r[s]);if(R)for(var s of R(r))J.call(r,s)&&O(e,s,r[s]);return e};var M=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),k=(e,r)=>{for(var s in r)c(e,s,{get:r[s],enumerable:!0})},_=(e,r,s,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of H(r))!E.call(e,o)&&o!==s&&c(e,o,{get:()=>r[o],enumerable:!(t=F(r,o))||t.enumerable});return e};var V=(e,r,s)=>(s=e!=null?C(W(e)):{},_(r||!e||!e.__esModule?c(s,"default",{value:e,enumerable:!0}):s,e)),j=e=>_(c({},"__esModule",{value:!0}),e);var x=M((se,I)=>{"use strict";var G=[776,2359,2359,2367,2367,2984,3007,3021,3633,3635,3648,3657,4352,4449,4520];function b(e){if(typeof e!="string")throw new Error("string cannot be undefined or null");let r=[],s=0,t=0;for(;s<e.length;){if(t+=L(s+t,e),Z(e[s+t])&&t++,K(e[s+t])&&t++,U(e[s+t])&&t++,Y(e[s+t])){t++;continue}r.push(e.substring(s,s+t)),s+=t,t=0}return r}function L(e,r){let s=r[e];if(!P(s)||e===r.length-1)return 1;let t=s+r[e+1],o=r.substring(e+2,e+5);return w(t)&&w(o)||q(o)?4:2}function P(e){return e&&y(e[0].charCodeAt(0),55296,56319)}function w(e){return y($(e),127462,127487)}function q(e){return y($(e),127995,127999)}function K(e){return typeof e=="string"&&y(e.charCodeAt(0),65024,65039)}function U(e){return typeof e=="string"&&y(e.charCodeAt(0),8400,8447)}function Z(e){return typeof e=="string"&&G.indexOf(e.charCodeAt(0))!==-1}function Y(e){return typeof e=="string"&&e.charCodeAt(0)===8205}function $(e){let r=e.charCodeAt(0)-55296,s=e.charCodeAt(1)-56320;return(r<<10)+s+65536}function y(e,r,s){return e>=r&&e<=s}function B(e,r,s){let t=b(e);if(r===void 0)return e;if(r>=t.length)return"";let o=t.length-r,u=r+(s===void 0?o:s);return u>r+o&&(u=void 0),t.slice(r,u).join("")}I.exports=b;I.exports.substr=B});var ne={};k(ne,{rProcessOutside:()=>re,version:()=>ee});var S=V(x(),1);var z={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function A(e,r){if(!Array.isArray(e)||!e.length)return e;let s=f(f({},z),r),t,o;if(s.strictlyTwoElementsInRangeArrays&&!e.every((l,a)=>!Array.isArray(l)||l.length!==2?(t=a,o=l.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, ${t}th range (${JSON.stringify(e[t],null,4)}) has not two but ${o} elements!`);if(!e.every((l,a)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(t=a,!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, ${t}th range (${JSON.stringify(e[t],null,4)}) does not consist of only natural numbers!`);let i=e.length**2,u=0;return Array.from(e).sort((l,a)=>(s.progressFn&&(u+=1,s.progressFn(Math.floor(u*100/i))),l[0]===a[0]?l[1]<a[1]?-1:l[1]>a[1]?1:0:l[0]<a[0]?-1:1))}var D={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function m(e,r){function s(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;let t;if(r)if(s(r)){if(t=f(f({},D),r),t.progressFn&&s(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof t.progressFn}", equal to ${JSON.stringify(t.progressFn,null,4)}`);if(![1,2,"1","2"].includes(t.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof t.mergeType}", equal to ${JSON.stringify(t.mergeType,null,4)}`);if(typeof t.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 t.joinRangesThatTouchEdges}", equal to ${JSON.stringify(t.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
11
11
  ${JSON.stringify(r,null,4)} (type ${typeof r})`);else t=f({},D);let o=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),i,u,l;t.progressFn?i=A(o,{progressFn:n=>{l=Math.floor(n/5),l!==u&&(u=l,t.progressFn(l))}}):i=A(o);let a=i.length-1;for(let n=a;n>0;n--)t.progressFn&&(l=Math.floor((1-n/a)*78)+21,l!==u&&l>u&&(u=l,t.progressFn(l))),(i[n][0]<=i[n-1][0]||!t.joinRangesThatTouchEdges&&i[n][0]<i[n-1][1]||t.joinRangesThatTouchEdges&&i[n][0]<=i[n-1][1])&&(i[n-1][0]=Math.min(i[n][0],i[n-1][0]),i[n-1][1]=Math.max(i[n][1],i[n-1][1]),i[n][2]!==void 0&&(i[n-1][0]>=i[n][0]||i[n-1][1]<=i[n][1])&&i[n-1][2]!==null&&(i[n][2]===null&&i[n-1][2]!==null?i[n-1][2]=null:i[n-1][2]!=null?+t.mergeType==2&&i[n-1][0]===i[n][0]?i[n-1][2]=i[n][2]:i[n-1][2]+=i[n][2]:i[n-1][2]=i[n][2]),i.splice(n,1),n=i.length);return i.length?i:null}function d(e,r){if(e===null)return null;if(!Array.isArray(e))throw new TypeError(`ranges-crop: [THROW_ID_01] The first input's argument must be an array, consisting of range arrays! Currently its type is: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(!Number.isInteger(r))throw new TypeError(`ranges-crop: [THROW_ID_02] The second input's argument must be a natural number or zero (coming from String.length)! Currently its type is: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(!e.filter(o=>o).length)return e.filter(o=>o);let s=0;if(!e.filter(o=>o).every((o,i)=>!Number.isInteger(o[0])||!Number.isInteger(o[1])?(s=i,!1):!0))throw Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number"?new TypeError(`ranges-crop: [THROW_ID_03] The first argument should be AN ARRAY OF RANGES, not a single range! Currently arrOfRanges = ${JSON.stringify(e,null,0)}!`):new TypeError(`ranges-crop: [THROW_ID_04] The first argument should be AN ARRAY OF ARRAYS! Each sub-array means string slice indexes. In our case, here ${s}th range (${JSON.stringify(e[s],null,0)}) does not consist of only natural numbers!`);if(!e.filter(o=>o).every((o,i)=>o[2]!=null&&typeof o[2]!="string"?(s=i,!1):!0))throw new TypeError(`ranges-crop: [THROW_ID_05] The third argument, if present at all, should be of a string-type or null. Currently the ${s}th range ${JSON.stringify(e[s],null,0)} has a argument in the range of a type ${typeof e[s][2]}`);let t=(m(e)||[]).filter(o=>o[0]<=r&&(o[2]!=null||o[0]<r)).map(o=>o[1]>r?o[2]!=null?[o[0],r,o[2]]:[o[0],r]:o);return t.length?t:null}var Q={strictlyTwoElementsInRangeArrays:!1,skipChecks:!1};function N(e,r,s){if(!Array.isArray(e)&&e!==null)throw new TypeError(`ranges-invert: [THROW_ID_01] Input's first argument must be an array, consisting of range arrays! Currently its type is: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(!Number.isInteger(r)||r<0)throw new TypeError(`ranges-invert: [THROW_ID_02] Input's second argument must be a natural number or zero (coming from String.length)! Currently its type is: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number")throw new TypeError(`ranges-invert: [THROW_ID_07] The first argument should be AN ARRAY OF RANGES, not a single range! Currently arrOfRanges = ${JSON.stringify(e,null,0)}!`);if(!Array.isArray(e)||!e.filter(a=>Array.isArray(a)&&a[0]!==a[1]).length||!r)return r?[[0,r]]:null;let t=f(f({},Q),s),o=0,i;if(!t.skipChecks&&t.strictlyTwoElementsInRangeArrays&&!e.filter(a=>a).every((a,n)=>a.length!==2?(o=n,i=a.length,!1):!0))throw new TypeError(`ranges-invert: [THROW_ID_04] Because opts.strictlyTwoElementsInRangeArrays was enabled, all ranges must be strictly two-element-long. However, the ${o}th range (${JSON.stringify(e[o],null,0)}) has not two but ${i} elements!`);if(!t.skipChecks&&!e.every((a,n)=>!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(o=n,!1):!0))throw new TypeError(`ranges-invert: [THROW_ID_05] The first argument should be AN ARRAY OF ARRAYS! Each sub-array means string slice indexes. In our case, here ${o+1}th range (${JSON.stringify(e[o],null,0)}) does not consist of only natural numbers!`);let u;t.skipChecks?u=e.filter(a=>a[0]!==a[1]):u=m(e.filter(a=>a[0]!==a[1]));let l=u.reduce((a,n,g,p)=>{let T=[];g===0&&p[0][0]!==0&&T.push([0,p[0][0]]);let h=g<p.length-1?p[g+1][0]:r;if(n[1]!==h){if(t.skipChecks&&n[1]>h)throw new TypeError(`ranges-invert: [THROW_ID_08] The checking (opts.skipChecks) is off and input ranges were not sorted! We nearly wrote range [${n[1]}, ${h}] which is backwards. For investigation, whole ranges array is:
12
- ${JSON.stringify(p,null,0)}`);T.push([n[1],h])}return a.concat(T)},[]);return d(l,r)}var v="6.0.6";var ee=v;function re(e,r,s,t=!1){if(typeof e!="string")throw e===void 0?new Error("ranges-process-outside: [THROW_ID_01] the first input argument must be string! It's missing currently (undefined)!"):new Error(`ranges-process-outside: [THROW_ID_02] the first input argument must be string! It was given as:
12
+ ${JSON.stringify(p,null,0)}`);T.push([n[1],h])}return a.concat(T)},[]);return d(l,r)}var v="6.0.7";var ee=v;function re(e,r,s,t=!1){if(typeof e!="string")throw e===void 0?new Error("ranges-process-outside: [THROW_ID_01] the first input argument must be string! It's missing currently (undefined)!"):new Error(`ranges-process-outside: [THROW_ID_02] the first input argument must be string! It was given as:
13
13
  ${JSON.stringify(e,null,4)} (type ${typeof e})`);if(r&&(!Array.isArray(r)||r.length&&!Array.isArray(r[0])))throw new Error(`ranges-process-outside: [THROW_ID_03] the second input argument must be array of ranges or null! It was given as:
14
14
  ${JSON.stringify(r,null,4)} (type ${typeof r})`);if(typeof s!="function")throw new Error(`ranges-process-outside: [THROW_ID_04] the third input argument must be a function! It was given as:
15
15
  ${JSON.stringify(s,null,4)} (type ${typeof s})`);function o(i,u){(u||[]).forEach(([l,a])=>{for(let n=l;n<a;n++){let g=(0,S.default)(i.slice(n))[0].length;s(n,n+g,p=>{p!=null&&(n+=p)}),g&&g>1&&(n+=g-1)}})}if(r!=null&&r.length){let i=d(N(r,e.length,{skipChecks:!!t}),e.length);o(e,i)}else o(e,[[0,e.length]])}return j(ne);})();
16
16
  /**
17
17
  * @name ranges-sort
18
18
  * @fileoverview Sort string index ranges
19
- * @version 6.0.6
19
+ * @version 6.0.7
20
20
  * @author Roy Revelt, Codsen Ltd
21
21
  * @license MIT
22
22
  * {@link https://codsen.com/os/ranges-sort/}
@@ -24,7 +24,7 @@ ${JSON.stringify(s,null,4)} (type ${typeof s})`);function o(i,u){(u||[]).forEach
24
24
  /**
25
25
  * @name ranges-merge
26
26
  * @fileoverview Merge and sort string index ranges
27
- * @version 9.0.6
27
+ * @version 9.0.7
28
28
  * @author Roy Revelt, Codsen Ltd
29
29
  * @license MIT
30
30
  * {@link https://codsen.com/os/ranges-merge/}
@@ -32,7 +32,7 @@ ${JSON.stringify(s,null,4)} (type ${typeof s})`);function o(i,u){(u||[]).forEach
32
32
  /**
33
33
  * @name ranges-crop
34
34
  * @fileoverview Crop array of ranges when they go beyond the reference string's length
35
- * @version 6.0.6
35
+ * @version 6.0.7
36
36
  * @author Roy Revelt, Codsen Ltd
37
37
  * @license MIT
38
38
  * {@link https://codsen.com/os/ranges-crop/}
@@ -40,7 +40,7 @@ ${JSON.stringify(s,null,4)} (type ${typeof s})`);function o(i,u){(u||[]).forEach
40
40
  /**
41
41
  * @name ranges-invert
42
42
  * @fileoverview Invert string index ranges
43
- * @version 6.0.6
43
+ * @version 6.0.7
44
44
  * @author Roy Revelt, Codsen Ltd
45
45
  * @license MIT
46
46
  * {@link https://codsen.com/os/ranges-invert/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ranges-process-outside",
3
- "version": "6.0.6",
3
+ "version": "6.0.7",
4
4
  "description": "Iterate string considering ranges, as if they were already applied",
5
5
  "keywords": [
6
6
  "array",
@@ -65,8 +65,8 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "ranges-crop": "^6.0.6",
69
- "ranges-invert": "^6.0.6",
68
+ "ranges-crop": "^6.0.7",
69
+ "ranges-invert": "^6.0.7",
70
70
  "runes": "^0.4.3"
71
71
  },
72
72
  "devDependencies": {