ranges-process-outside 6.0.30 → 6.0.31

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.
package/.eslintcache ADDED
@@ -0,0 +1 @@
1
+ [{"/home/runner/work/codsen/codsen/packages/ranges-process-outside/examples/_quickTake.js":"1","/home/runner/work/codsen/codsen/packages/ranges-process-outside/perf/check.js":"2","/home/runner/work/codsen/codsen/packages/ranges-process-outside/rollup.config.js":"3","/home/runner/work/codsen/codsen/packages/ranges-process-outside/src/main.ts":"4","/home/runner/work/codsen/codsen/packages/ranges-process-outside/test/test.js":"5"},{"size":384,"mtime":1760280945948,"results":"6","hashOfConfig":"7"},{"size":367,"mtime":1760280945948,"results":"8","hashOfConfig":"9"},{"size":373,"mtime":1760280945948,"results":"10","hashOfConfig":"7"},{"size":4138,"mtime":1760280945948,"results":"11","hashOfConfig":"9"},{"size":8474,"mtime":1760280945948,"results":"12","hashOfConfig":"13"},{"filePath":"14","messages":"15","suppressedMessages":"16","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1f1u168",{"filePath":"17","messages":"18","suppressedMessages":"19","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"91l1rm",{"filePath":"20","messages":"21","suppressedMessages":"22","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","suppressedMessages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","suppressedMessages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ns3qdb","/home/runner/work/codsen/codsen/packages/ranges-process-outside/examples/_quickTake.js",[],[],"/home/runner/work/codsen/codsen/packages/ranges-process-outside/perf/check.js",[],[],"/home/runner/work/codsen/codsen/packages/ranges-process-outside/rollup.config.js",[],[],"/home/runner/work/codsen/codsen/packages/ranges-process-outside/src/main.ts",[],[],"/home/runner/work/codsen/codsen/packages/ranges-process-outside/test/test.js",[],["29","30","31","32"],{"ruleId":"33","severity":2,"message":"34","line":3,"column":17,"nodeType":null,"messageId":"35","endLine":3,"endColumn":19,"suppressions":"36"},{"ruleId":"33","severity":2,"message":"37","line":3,"column":21,"nodeType":null,"messageId":"35","endLine":3,"endColumn":23,"suppressions":"38"},{"ruleId":"33","severity":2,"message":"39","line":3,"column":33,"nodeType":null,"messageId":"35","endLine":3,"endColumn":37,"suppressions":"40"},{"ruleId":"33","severity":2,"message":"41","line":3,"column":44,"nodeType":null,"messageId":"35","endLine":3,"endColumn":49,"suppressions":"42"},"@typescript-eslint/no-unused-vars","'is' is defined but never used.","unusedVar",["43"],"'ok' is defined but never used.",["44"],"'type' is defined but never used.",["45"],"'match' is defined but never used.",["46"],{"kind":"47","justification":"48"},{"kind":"47","justification":"48"},{"kind":"47","justification":"48"},{"kind":"47","justification":"48"},"directive",""]
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2025 Roy Revelt and other contributors
3
+ Copyright © 2010-2025 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -62,8 +62,8 @@ To report bugs or request features or assistance, [raise an issue](https://githu
62
62
 
63
63
  ## Licence
64
64
 
65
- MIT License.
65
+ MIT License
66
66
 
67
- Copyright © 2010-2025 Roy Revelt and other contributors.
67
+ Copyright © 2010-2025 Roy Revelt and other contributors
68
68
 
69
69
  <p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
@@ -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.30
5
- * @author Roy Revelt, Codsen Ltd
4
+ * @version 6.0.31
5
+ * @author Roy Revelt
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.30";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.31";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 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,42 +1,42 @@
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.30
5
- * @author Roy Revelt, Codsen Ltd
4
+ * @version 6.0.31
5
+ * @author Roy Revelt
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 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.30";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);})();
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.31";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);})();
11
11
  /**
12
12
  * @name ranges-sort
13
13
  * @fileoverview Sort string index ranges
14
- * @version 6.0.24
15
- * @author Roy Revelt, Codsen Ltd
14
+ * @version 6.0.25
15
+ * @author Roy Revelt
16
16
  * @license MIT
17
17
  * {@link https://codsen.com/os/ranges-sort/}
18
18
  */
19
19
  /**
20
20
  * @name ranges-merge
21
21
  * @fileoverview Merge and sort string index ranges
22
- * @version 9.0.29
23
- * @author Roy Revelt, Codsen Ltd
22
+ * @version 9.0.30
23
+ * @author Roy Revelt
24
24
  * @license MIT
25
25
  * {@link https://codsen.com/os/ranges-merge/}
26
26
  */
27
27
  /**
28
28
  * @name ranges-crop
29
29
  * @fileoverview Crop array of ranges when they go beyond the reference string's length
30
- * @version 6.0.30
31
- * @author Roy Revelt, Codsen Ltd
30
+ * @version 6.0.31
31
+ * @author Roy Revelt
32
32
  * @license MIT
33
33
  * {@link https://codsen.com/os/ranges-crop/}
34
34
  */
35
35
  /**
36
36
  * @name ranges-invert
37
37
  * @fileoverview Invert string index ranges
38
- * @version 6.0.30
39
- * @author Roy Revelt, Codsen Ltd
38
+ * @version 6.0.31
39
+ * @author Roy Revelt
40
40
  * @license MIT
41
41
  * {@link https://codsen.com/os/ranges-invert/}
42
42
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ranges-process-outside",
3
- "version": "6.0.30",
3
+ "version": "6.0.31",
4
4
  "description": "Iterate string considering ranges, as if they were already applied",
5
5
  "keywords": [
6
6
  "array",
@@ -38,7 +38,7 @@
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
40
  "letspublish": "npm publish --provenance || :",
41
- "lint": "eslint . --fix",
41
+ "lint": "eslint . --fix --concurrency=auto --cache",
42
42
  "perf": "node perf/check.js",
43
43
  "prep": "echo 'ready'",
44
44
  "prettier": "prettier",
@@ -65,8 +65,8 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "ranges-crop": "^6.0.30",
69
- "ranges-invert": "^6.0.30",
68
+ "ranges-crop": "^6.0.31",
69
+ "ranges-invert": "^6.0.31",
70
70
  "runes": "^0.4.3"
71
71
  },
72
72
  "devDependencies": {