ranges-process-outside 6.0.19 → 6.0.29

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.19
4
+ * @version 6.0.29
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.19";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.29";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
- ${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};
13
+ ${JSON.stringify(r,null,4)} (type ${typeof r})`);function p(o,c){(c||[]).forEach(([d,m])=>{for(let s=d;s<m;s++){let n=f(o.slice(s))[0].length;r(s,s+n,l=>{l!=null&&(s+=l)}),n&&n>1&&(s+=n-1)}})}if(t?.length){let o=y(g(t,e.length,{skipChecks:!!i}),e.length);p(e,o)}else p(e,[[0,e.length]])}export{D as rProcessOutside,E as version};
@@ -1,22 +1,17 @@
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.19
4
+ * @version 6.0.29
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
- "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
- ${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.19";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
- ${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
- ${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
- ${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);})();
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 w(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 b(t)&&b(o)||q(o)?4:2}function P(e){return e&&y(e[0].charCodeAt(0),55296,56319)}function b(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=w(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=w;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, ".concat(t,"th range (").concat(JSON.stringify(e[t],null,4),") has not two but ").concat(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, ".concat(t,"th range (").concat(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: "'.concat(typeof t.progressFn,'", equal to ').concat(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: "'.concat(typeof t.mergeType,'", equal to ').concat(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: "'.concat(typeof t.joinRangesThatTouchEdges,'", equal to ').concat(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:\n".concat(JSON.stringify(r,null,4)," (type ").concat(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: ".concat(typeof e,", equal to: ").concat(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: ".concat(typeof r,", equal to: ").concat(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 = ".concat(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 ".concat(s,"th range (").concat(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 ".concat(s,"th range ").concat(JSON.stringify(e[s],null,0)," has a argument in the range of a type ").concat(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: ".concat(typeof e,", equal to: ").concat(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: ".concat(typeof r,", equal to: ").concat(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 = ".concat(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 ".concat(o,"th range (").concat(JSON.stringify(e[o],null,0),") has not two but ").concat(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 ".concat(o+1,"th range (").concat(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 [".concat(n[1],", ").concat(h,"] which is backwards. For investigation, whole ranges array is:\n").concat(JSON.stringify(p,null,0)));T.push([n[1],h])}return a.concat(T)},[]);return d(l,r)}var v="6.0.29";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:\n".concat(JSON.stringify(e,null,4)," (type ").concat(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:\n".concat(JSON.stringify(r,null,4)," (type ").concat(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:\n".concat(JSON.stringify(s,null,4)," (type ").concat(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
11
  /**
17
12
  * @name ranges-sort
18
13
  * @fileoverview Sort string index ranges
19
- * @version 6.0.13
14
+ * @version 6.0.23
20
15
  * @author Roy Revelt, Codsen Ltd
21
16
  * @license MIT
22
17
  * {@link https://codsen.com/os/ranges-sort/}
@@ -24,7 +19,7 @@ ${JSON.stringify(s,null,4)} (type ${typeof s})`);function o(i,u){(u||[]).forEach
24
19
  /**
25
20
  * @name ranges-merge
26
21
  * @fileoverview Merge and sort string index ranges
27
- * @version 9.0.18
22
+ * @version 9.0.28
28
23
  * @author Roy Revelt, Codsen Ltd
29
24
  * @license MIT
30
25
  * {@link https://codsen.com/os/ranges-merge/}
@@ -32,7 +27,7 @@ ${JSON.stringify(s,null,4)} (type ${typeof s})`);function o(i,u){(u||[]).forEach
32
27
  /**
33
28
  * @name ranges-crop
34
29
  * @fileoverview Crop array of ranges when they go beyond the reference string's length
35
- * @version 6.0.19
30
+ * @version 6.0.29
36
31
  * @author Roy Revelt, Codsen Ltd
37
32
  * @license MIT
38
33
  * {@link https://codsen.com/os/ranges-crop/}
@@ -40,7 +35,7 @@ ${JSON.stringify(s,null,4)} (type ${typeof s})`);function o(i,u){(u||[]).forEach
40
35
  /**
41
36
  * @name ranges-invert
42
37
  * @fileoverview Invert string index ranges
43
- * @version 6.0.19
38
+ * @version 6.0.29
44
39
  * @author Roy Revelt, Codsen Ltd
45
40
  * @license MIT
46
41
  * {@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.19",
3
+ "version": "6.0.29",
4
4
  "description": "Iterate string considering ranges, as if they were already applied",
5
5
  "keywords": [
6
6
  "array",
@@ -37,7 +37,7 @@
37
37
  "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
38
38
  "examples": "node '../../ops/scripts/run-examples.js'",
39
39
  "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
40
- "letspublish": "npm publish || :",
40
+ "letspublish": "npm publish --provenance || :",
41
41
  "lint": "eslint . --fix",
42
42
  "perf": "node perf/check.js",
43
43
  "prep": "echo 'ready'",
@@ -65,11 +65,14 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "ranges-crop": "^6.0.19",
69
- "ranges-invert": "^6.0.19",
68
+ "ranges-crop": "^6.0.29",
69
+ "ranges-invert": "^6.0.29",
70
70
  "runes": "^0.4.3"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/runes": "^0.4.3"
74
+ },
75
+ "publishConfig": {
76
+ "registry": "https://registry.npmjs.org/"
74
77
  }
75
78
  }
package/types/index.d.ts CHANGED
@@ -15,4 +15,5 @@ declare function rProcessOutside(
15
15
  skipChecks?: boolean,
16
16
  ): void;
17
17
 
18
- export { type Callback, type OffsetValueCb, rProcessOutside, version };
18
+ export { rProcessOutside, version };
19
+ export type { Callback, OffsetValueCb };