ranges-process-outside 6.2.1 → 6.2.2
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/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.2.2 (2026-08-22)
|
|
7
|
+
|
|
8
|
+
### Performance Improvements
|
|
9
|
+
|
|
10
|
+
- optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
|
|
11
|
+
|
|
6
12
|
## 6.2.0 (2026-08-19)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
9
15
|
|
|
10
16
|
- make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
|
|
11
|
-
- resolve review findings
|
|
17
|
+
- resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
|
|
12
18
|
- retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
|
|
13
19
|
|
|
14
20
|
### Features
|
|
@@ -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.2.
|
|
4
|
+
* @version 6.2.2
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ranges-process-outside/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{formatDiagnosticValue as c}from"codsen-utils";import{rCrop as y}from"ranges-crop";import{rInvert as $}from"ranges-invert";var a="6.2.
|
|
10
|
+
import{formatDiagnosticValue as c}from"codsen-utils";import{rCrop as y}from"ranges-crop";import{rInvert as $}from"ranges-invert";var a="6.2.2";var I=a;function D(e,t,r,m=!1){if(typeof e!="string")throw e===void 0?new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_01] the first input argument must be string! It's missing currently (undefined)!"):new Error(`ranges-process-outside/rProcessOutside(): [THROW_ID_02] the first input argument must be string! It was given as:
|
|
11
11
|
${c(e,4)} (type ${typeof e})`);if(t!=null&&(!Array.isArray(t)||t.length&&!Array.isArray(t[0])))throw new Error(`ranges-process-outside/rProcessOutside(): [THROW_ID_03] the second input argument must be array of ranges or null! It was given as:
|
|
12
12
|
${c(t,4)} (type ${typeof t})`);if(typeof r!="function")throw new Error(`ranges-process-outside/rProcessOutside(): [THROW_ID_04] the third input argument must be a function! It was given as:
|
|
13
13
|
${c(r,4)} (type ${typeof r})`);function p(o,f){let l=new Uint32Array(o.length),u=0;for(let n of o)l[u]=n.length,u+=n.length;(f||[]).forEach(([n,g])=>{for(let s=n;s<g;s++){let i=l[s]||1;r(s,s+i,d=>{d!=null&&(s+=d)}),i&&i>1&&(s+=i-1)}})}if(t?.length){let o=y($(t,e.length,{skipChecks:!!m}),e.length);p(e,o)}else p(e,[[0,e.length]])}export{D as rProcessOutside,I as version};
|
|
@@ -1,17 +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.2.
|
|
4
|
+
* @version 6.2.2
|
|
5
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 $=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames,D=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var R=(e,n,t)=>n in e?$(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,m=(e,n)=>{for(var t in n||(n={}))E.call(n,t)&&R(e,t,n[t]);if(D)for(var t of D(n))F.call(n,t)&&R(e,t,n[t]);return e};var N=(e,n)=>{for(var t in n)$(e,t,{get:n[t],enumerable:!0})},H=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of M(n))!E.call(e,u)&&u!==t&&$(e,u,{get:()=>n[u],enumerable:!(r=j(n,u))||r.enumerable});return e};var V=e=>H($({},"__esModule",{value:!0}),e);var J={};N(J,{rProcessOutside:()=>G,version:()=>z});function B(){let e=[],n=0,t=!1;return{append(r){return t?!1:n+r.length>1999?(e.push("\u2026"),n+=1,t=!0,!1):(e.push(r),n+=r.length,!0)},result(){return e.join("")},stopped(){return t}}}function L(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function T(e,n){if(e.append('"')){for(let t=0;t<n.length&&!e.stopped();t+=1){let r=n.charCodeAt(t);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(L(r)):e.append(n[t])}e.append('"')}}function P(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function W(e,n){e.append("Symbol(");let t=String(n);t.length>8&&T(e,t.slice(7,-1)),e.append(")")}function k(e,n){typeof n=="symbol"?W(e,n):T(e,String(n))}function f(e,n=0){let t=B(),r=n===4?4:0,u=new WeakSet,o=0;function c(l){r&&t.append(" ".repeat(l*r))}function i(l,p){l&&t.append(","),r&&(t.append("\n"),c(p+1))}function a(l,p,g){r&&p&&(t.append("\n"),c(g)),t.append(l)}function s(l,p){Object.prototype.hasOwnProperty.call(l,"value")?A(l.value,p):t.append(P(l))}function C(l,p){let g;try{g=Reflect.getOwnPropertyDescriptor(l,"length")}catch(d){t.append("[Uninspectable]");return}let h=g==null?void 0:g.value;if(!Number.isSafeInteger(h)||h<0){t.append("[Uninspectable]");return}t.append("[");let b=!1;for(let d=0;d<h&&!t.stopped();d+=1){if(i(b,p),b=!0,o>=50){t.append("[MaxEntries]");break}o+=1;let v;try{v=Reflect.getOwnPropertyDescriptor(l,String(d))}catch(K){t.append("[Uninspectable]");continue}v!=null&&v.enumerable?s(v,p+1):t.append("[Empty]")}a("]",b,p)}function y(l,p){let g;try{g=Reflect.ownKeys(l)}catch(b){t.append("[Uninspectable]");return}t.append("{");let h=!1;for(let b of g){if(t.stopped())break;if(o>=50){i(h,p),h=!0,T(t,"\u2026"),t.append(r?": ":":"),t.append("[MaxEntries]");break}o+=1;let d;try{d=Reflect.getOwnPropertyDescriptor(l,b)}catch(v){i(h,p),h=!0,k(t,b),t.append(r?": ":":"),t.append("[Uninspectable]");continue}d!=null&&d.enumerable&&(i(h,p),h=!0,k(t,b),t.append(r?": ":":"),s(d,p+1))}a("}",h,p)}function w(l,p){if(u.has(l)){t.append("[Circular]");return}if(p>=5){t.append("[MaxDepth]");return}let g;try{g=Array.isArray(l)}catch(h){t.append("[Uninspectable]");return}u.add(l);try{g?C(l,p):y(l,p)}finally{u.delete(l)}}function A(l,p){l===null?t.append("null"):typeof l=="string"?T(t,l):typeof l=="number"?t.append(Object.is(l,-0)?"-0":String(l)):typeof l=="boolean"?t.append(l?"true":"false"):typeof l>"u"?t.append("undefined"):typeof l=="bigint"?t.append("".concat(l,"n")):typeof l=="symbol"?W(t,l):typeof l=="function"?t.append("[Function]"):w(l,p)}try{return A(e,0),t.result()}catch(l){return"[Uninspectable]"}}var ee=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var U={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function x(e,n){if(!Array.isArray(e)||!e.length)return e;let t=m(m({},U),n),r,u;if(t.strictlyTwoElementsInRangeArrays&&!e.every((i,a)=>!Array.isArray(i)||i.length!==2?(r=a,u=i.length,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_01] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ".concat(r,"th range (").concat(f(e[r],4),") has not two but ").concat(u," elements!"));if(!e.every((i,a)=>!Array.isArray(i)||!Number.isInteger(i[0])||i[0]<0||!Number.isInteger(i[1])||i[1]<0?(r=a,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(r,"th range (").concat(f(e[r],4),") does not consist of only natural numbers!"));let o=e.length**2,c=0;return Array.from(e).sort((i,a)=>(t.progressFn&&(c+=1,t.progressFn(Math.floor(c*100/o))),i[0]===a[0]?i[1]<a[1]?-1:i[1]>a[1]?1:0:i[0]<a[0]?-1:1))}var q={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function I(e,n){function t(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;if(n&&!t(n))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(f(n,4)," (type ").concat(typeof n,")"));let r=m(m({},q),n);if(r.progressFn&&t(r.progressFn)&&!Object.keys(r.progressFn).length)r.progressFn=null;else if(r.progressFn&&typeof r.progressFn!="function")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_02] opts.progressFn must be a function! It was given of a type: "'.concat(typeof r.progressFn,'", equal to ').concat(f(r.progressFn,4)));if(![1,2,"1","2"].includes(r.mergeType))throw new TypeError('ranges-merge/rMerge(): [THROW_ID_03] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof r.mergeType,'", equal to ').concat(f(r.mergeType,4)));if(typeof r.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof r.joinRangesThatTouchEdges,'", equal to ').concat(f(r.joinRangesThatTouchEdges,4)));let u=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),o,c,i;r.progressFn?o=x(u,{progressFn:s=>{i=Math.floor(s/5),i!==c&&(c=i,r.progressFn(i))}}):o=x(u);let a=o.length-1;for(let s=a;s>0;s--)r.progressFn&&(i=Math.floor((1-s/a)*78)+21,i!==c&&i>c&&(c=i,r.progressFn(i))),(o[s][0]<=o[s-1][0]||!r.joinRangesThatTouchEdges&&o[s][0]<o[s-1][1]||r.joinRangesThatTouchEdges&&o[s][0]<=o[s-1][1])&&(o[s-1][0]=Math.min(o[s][0],o[s-1][0]),o[s-1][1]=Math.max(o[s][1],o[s-1][1]),o[s][2]!==void 0&&(o[s-1][0]>=o[s][0]||o[s-1][1]<=o[s][1])&&o[s-1][2]!==null&&(o[s][2]===null&&o[s-1][2]!==null?o[s-1][2]=null:o[s-1][2]!=null?+r.mergeType==2&&o[s-1][0]===o[s][0]?o[s-1][2]=o[s][2]:o[s-1][2]+=o[s][2]:o[s-1][2]=o[s][2]),o.splice(s,1),s=o.length);return o.length?o:null}function O(e,n){if(e===null)return null;if(!Array.isArray(e))throw new TypeError("ranges-crop/rCrop(): [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(f(e,4)));if(!Number.isInteger(n)||n<0)throw new TypeError("ranges-crop/rCrop(): [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 n,", equal to: ").concat(f(n,4)));if(!e.some(Boolean))return[];if(typeof e[0]=="number"&&typeof e[1]=="number")throw new TypeError("ranges-crop/rCrop(): [THROW_ID_03] The first argument should be AN ARRAY OF RANGES, not a single range! Currently arrOfRanges = ".concat(f(e),"!"));for(let r=0;r<e.length;r++){let u=e[r];if(u){if(!Array.isArray(u)||!Number.isInteger(u[0])||u[0]<0||!Number.isInteger(u[1])||u[1]<0)throw new TypeError("ranges-crop/rCrop(): [THROW_ID_04] The first argument should be AN ARRAY OF ARRAYS! Each sub-array means string slice indexes. In our case, here ".concat(r,"th range (").concat(f(u),") does not consist of only natural numbers!"));if(u[2]!=null&&typeof u[2]!="string")throw new TypeError("ranges-crop/rCrop(): [THROW_ID_05] The third argument, if present at all, should be of a string-type or null. Currently the ".concat(r,"th range ").concat(f(u)," has a argument in the range of a type ").concat(typeof u[2]))}}let t=(I(e)||[]).filter(r=>r[0]<=n&&(r[2]!=null||r[0]<n)).map(r=>r[1]>n?r[2]!=null?[r[0],n,r[2]]:[r[0],n]:r);return t.length?t:null}var Y={strictlyTwoElementsInRangeArrays:!1,skipChecks:!1};function S(e,n,t){if(!Array.isArray(e)&&e!==null)throw new TypeError("ranges-invert/rInvert(): [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(f(e,4)));if(!Number.isInteger(n)||n<0)throw new TypeError("ranges-invert/rInvert(): [THROW_ID_02] Input's second argument must be a natural number or zero (coming from String.length)! Currently its type is: ".concat(typeof n,", equal to: ").concat(f(n,4)));if(Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number")throw new TypeError("ranges-invert/rInvert(): [THROW_ID_03] The first argument should be AN ARRAY OF RANGES, not a single range! Currently arrOfRanges = ".concat(f(e),"!"));if(!Array.isArray(e)||!n)return n?[[0,n]]:null;let r=m(m({},Y),t),u=[];for(let i=0;i<e.length;i++){let a=e[i];if(a){if(!r.skipChecks){if(r.strictlyTwoElementsInRangeArrays&&(!Array.isArray(a)||a.length!==2))throw new TypeError("ranges-invert/rInvert(): [THROW_ID_04] Because opts.strictlyTwoElementsInRangeArrays was enabled, all ranges must be strictly two-element-long. However, the ".concat(i,"th range (").concat(f(a),") has not two but ").concat(a.length," elements!"));if(!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0)throw new TypeError("ranges-invert/rInvert(): [THROW_ID_05] The first argument should be AN ARRAY OF ARRAYS! Each sub-array means string slice indexes. In our case, here ".concat(i+1,"th range (").concat(f(a),") does not consist of only natural numbers!"))}Array.isArray(a)&&a[0]!==a[1]&&u.push(a)}}if(!u.length)return[[0,n]];let o;r.skipChecks?o=u:o=I(u);let c=[];for(let i=0;i<o.length;i++){let a=o[i];i===0&&o[0][0]!==0&&c.push([0,o[0][0]]);let s=i<o.length-1?o[i+1][0]:n;if(a[1]!==s){if(r.skipChecks&&a[1]>s)throw new TypeError("ranges-invert/rInvert(): [THROW_ID_06] The checking (opts.skipChecks) is off and input ranges were not sorted! We nearly wrote range [".concat(a[1],", ").concat(s,"] which is backwards. For investigation, whole ranges array is:\n").concat(f(o)));c.push([a[1],s])}}return O(c,n)}var _="6.2.1";var z=_;function G(e,n,t,r=!1){if(typeof e!="string")throw e===void 0?new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_01] the first input argument must be string! It's missing currently (undefined)!"):new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_02] the first input argument must be string! It was given as:\n".concat(f(e,4)," (type ").concat(typeof e,")"));if(n!=null&&(!Array.isArray(n)||n.length&&!Array.isArray(n[0])))throw new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_03] the second input argument must be array of ranges or null! It was given as:\n".concat(f(n,4)," (type ").concat(typeof n,")"));if(typeof t!="function")throw new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_04] the third input argument must be a function! It was given as:\n".concat(f(t,4)," (type ").concat(typeof t,")"));function u(o,c){let i=new Uint32Array(o.length),a=0;for(let s of o)i[a]=s.length,a+=s.length;(c||[]).forEach(([s,C])=>{for(let y=s;y<C;y++){let w=i[y]||1;t(y,y+w,A=>{A!=null&&(y+=A)}),w&&w>1&&(y+=w-1)}})}if(n!=null&&n.length){let o=O(S(n,e.length,{skipChecks:!!r}),e.length);u(e,o)}else u(e,[[0,e.length]])}return V(J);})();
|
|
10
|
+
"use strict";var rangesProcessOutside=(()=>{var T=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames,D=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var R=(e,n,t)=>n in e?T(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,w=(e,n)=>{for(var t in n||(n={}))E.call(n,t)&&R(e,t,n[t]);if(D)for(var t of D(n))H.call(n,t)&&R(e,t,n[t]);return e};var V=(e,n)=>{for(var t in n)T(e,t,{get:n[t],enumerable:!0})},N=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of M(n))!E.call(e,l)&&l!==t&&T(e,l,{get:()=>n[l],enumerable:!(r=F(n,l))||r.enumerable});return e};var B=e=>N(T({},"__esModule",{value:!0}),e);var K={};V(K,{rProcessOutside:()=>J,version:()=>G});function L(){let e=[],n=0,t=!1;return{append(r){return t?!1:n+r.length>1999?(e.push("\u2026"),n+=1,t=!0,!1):(e.push(r),n+=r.length,!0)},result(){return e.join("")},stopped(){return t}}}function P(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function O(e,n){if(e.append('"')){for(let t=0;t<n.length&&!e.stopped();t+=1){let r=n.charCodeAt(t);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(P(r)):e.append(n[t])}e.append('"')}}function U(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function S(e,n){e.append("Symbol(");let t=String(n);t.length>8&&O(e,t.slice(7,-1)),e.append(")")}function k(e,n){typeof n=="symbol"?S(e,n):O(e,String(n))}function u(e,n=0){let t=L(),r=n===4?4:0,l=new WeakSet,f=0;function h(s){r&&t.append(" ".repeat(s*r))}function o(s,a){s&&t.append(","),r&&(t.append("\n"),h(a+1))}function i(s,a,p){r&&a&&(t.append("\n"),h(p)),t.append(s)}function c(s,a){Object.prototype.hasOwnProperty.call(s,"value")?A(s.value,a):t.append(U(s))}function v(s,a){let p;try{p=Reflect.getOwnPropertyDescriptor(s,"length")}catch(b){t.append("[Uninspectable]");return}let g=p==null?void 0:p.value;if(!Number.isSafeInteger(g)||g<0){t.append("[Uninspectable]");return}t.append("[");let m=!1;for(let b=0;b<g&&!t.stopped();b+=1){if(o(m,a),m=!0,f>=50){t.append("[MaxEntries]");break}f+=1;let $;try{$=Reflect.getOwnPropertyDescriptor(s,String(b))}catch(Z){t.append("[Uninspectable]");continue}$!=null&&$.enumerable?c($,a+1):t.append("[Empty]")}i("]",m,a)}function y(s,a){let p;try{p=Reflect.ownKeys(s)}catch(m){t.append("[Uninspectable]");return}t.append("{");let g=!1;for(let m of p){if(t.stopped())break;if(f>=50){o(g,a),g=!0,O(t,"\u2026"),t.append(r?": ":":"),t.append("[MaxEntries]");break}f+=1;let b;try{b=Reflect.getOwnPropertyDescriptor(s,m)}catch($){o(g,a),g=!0,k(t,m),t.append(r?": ":":"),t.append("[Uninspectable]");continue}b!=null&&b.enumerable&&(o(g,a),g=!0,k(t,m),t.append(r?": ":":"),c(b,a+1))}i("}",g,a)}function d(s,a){if(l.has(s)){t.append("[Circular]");return}if(a>=5){t.append("[MaxDepth]");return}let p;try{p=Array.isArray(s)}catch(g){t.append("[Uninspectable]");return}l.add(s);try{p?v(s,a):y(s,a)}finally{l.delete(s)}}function A(s,a){s===null?t.append("null"):typeof s=="string"?O(t,s):typeof s=="number"?t.append(Object.is(s,-0)?"-0":String(s)):typeof s=="boolean"?t.append(s?"true":"false"):typeof s>"u"?t.append("undefined"):typeof s=="bigint"?t.append("".concat(s,"n")):typeof s=="symbol"?S(t,s):typeof s=="function"?t.append("[Function]"):d(s,a)}try{return A(e,0),t.result()}catch(s){return"[Uninspectable]"}}var te=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var j,re=(j=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:j.get;var ne=Date.prototype.getTime;var q={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function x(e,n){if(!Array.isArray(e)||!e.length)return e;let t=w(w({},q),n),r,l;if(t.strictlyTwoElementsInRangeArrays&&!e.every((o,i)=>!Array.isArray(o)||o.length!==2?(r=i,l=o.length,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_01] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ".concat(r,"th range (").concat(u(e[r],4),") has not two but ").concat(l," elements!"));if(!e.every((o,i)=>!Array.isArray(o)||!Number.isInteger(o[0])||o[0]<0||!Number.isInteger(o[1])||o[1]<0?(r=i,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(r,"th range (").concat(u(e[r],4),") does not consist of only natural numbers!"));let f=e.length**2,h=0;return Array.from(e).sort((o,i)=>(t.progressFn&&(h+=1,t.progressFn(Math.floor(h*100/f))),o[0]===i[0]?o[1]<i[1]?-1:o[1]>i[1]?1:0:o[0]<i[0]?-1:1))}var Y={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function I(e,n){function t(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;if(n&&!t(n))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(u(n,4)," (type ").concat(typeof n,")"));let r=w(w({},Y),n);if(r.progressFn&&t(r.progressFn)&&!Object.keys(r.progressFn).length)r.progressFn=null;else if(r.progressFn&&typeof r.progressFn!="function")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_02] opts.progressFn must be a function! It was given of a type: "'.concat(typeof r.progressFn,'", equal to ').concat(u(r.progressFn,4)));if(r.mergeType!==1&&r.mergeType!==2&&r.mergeType!=="1"&&r.mergeType!=="2")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_03] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof r.mergeType,'", equal to ').concat(u(r.mergeType,4)));if(typeof r.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof r.joinRangesThatTouchEdges,'", equal to ').concat(u(r.joinRangesThatTouchEdges,4)));let l=r.progressFn,f=r.joinRangesThatTouchEdges,h=[];for(let s of e)Array.isArray(s)&&(s[2]!==void 0||s[0]!==s[1])&&h.push([...s]);let o,i,c;l?o=x(h,{progressFn:s=>{c=Math.floor(s/5),c!==i&&(i=c,l(c))}}):o=x(h);let v=o.length-1,y=r.mergeType===2||r.mergeType==="2",d=o.length;for(let s=v;s>=0;s--){let a=o[s];for(l&&s<v&&(c=Math.floor((1-(s+1)/v)*78)+21,c!==i&&c>i&&(i=c,l(c)));d<o.length;){let p=o[d],g=p[0]===a[0];if(!g&&(f?p[0]>a[1]:p[0]>=a[1]))break;let m=p[1]>=a[1];m&&(a[1]=p[1]),p[2]!==void 0&&(g||m)&&a[2]!==null&&(p[2]===null&&a[2]!==null?a[2]=null:a[2]!=null?y&&g?a[2]=p[2]:a[2]+=p[2]:a[2]=p[2]),d+=1}d-=1,o[d]=a}let A=o.length-d;for(let s=0;s<A;s++)o[s]=o[d+s];return o.length=A,o.length?o:null}function C(e,n){if(e===null)return null;if(!Array.isArray(e))throw new TypeError("ranges-crop/rCrop(): [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(u(e,4)));if(!Number.isInteger(n)||n<0)throw new TypeError("ranges-crop/rCrop(): [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 n,", equal to: ").concat(u(n,4)));if(!e.some(Boolean))return[];if(typeof e[0]=="number"&&typeof e[1]=="number")throw new TypeError("ranges-crop/rCrop(): [THROW_ID_03] The first argument should be AN ARRAY OF RANGES, not a single range! Currently arrOfRanges = ".concat(u(e),"!"));for(let r=0;r<e.length;r++){let l=e[r];if(l){if(!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0)throw new TypeError("ranges-crop/rCrop(): [THROW_ID_04] The first argument should be AN ARRAY OF ARRAYS! Each sub-array means string slice indexes. In our case, here ".concat(r,"th range (").concat(u(l),") does not consist of only natural numbers!"));if(l[2]!=null&&typeof l[2]!="string")throw new TypeError("ranges-crop/rCrop(): [THROW_ID_05] The third argument, if present at all, should be of a string-type or null. Currently the ".concat(r,"th range ").concat(u(l)," has a argument in the range of a type ").concat(typeof l[2]))}}let t=(I(e)||[]).filter(r=>r[0]<=n&&(r[2]!=null||r[0]<n)).map(r=>r[1]>n?r[2]!=null?[r[0],n,r[2]]:[r[0],n]:r);return t.length?t:null}var Q={strictlyTwoElementsInRangeArrays:!1,skipChecks:!1};function W(e,n,t){if(!Array.isArray(e)&&e!==null)throw new TypeError("ranges-invert/rInvert(): [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(u(e,4)));if(!Number.isInteger(n)||n<0)throw new TypeError("ranges-invert/rInvert(): [THROW_ID_02] Input's second argument must be a natural number or zero (coming from String.length)! Currently its type is: ".concat(typeof n,", equal to: ").concat(u(n,4)));if(Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number")throw new TypeError("ranges-invert/rInvert(): [THROW_ID_03] The first argument should be AN ARRAY OF RANGES, not a single range! Currently arrOfRanges = ".concat(u(e),"!"));if(!Array.isArray(e)||!n)return n?[[0,n]]:null;let r=w(w({},Q),t),l=[];for(let o=0;o<e.length;o++){let i=e[o];if(i){if(!r.skipChecks){if(r.strictlyTwoElementsInRangeArrays&&(!Array.isArray(i)||i.length!==2))throw new TypeError("ranges-invert/rInvert(): [THROW_ID_04] Because opts.strictlyTwoElementsInRangeArrays was enabled, all ranges must be strictly two-element-long. However, the ".concat(o,"th range (").concat(u(i),") has not two but ").concat(i.length," elements!"));if(!Array.isArray(i)||!Number.isInteger(i[0])||i[0]<0||!Number.isInteger(i[1])||i[1]<0)throw new TypeError("ranges-invert/rInvert(): [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(u(i),") does not consist of only natural numbers!"))}Array.isArray(i)&&i[0]!==i[1]&&l.push(i)}}if(!l.length)return[[0,n]];let f;r.skipChecks?f=l:f=I(l);let h=[];for(let o=0;o<f.length;o++){let i=f[o];o===0&&f[0][0]!==0&&h.push([0,f[0][0]]);let c=o<f.length-1?f[o+1][0]:n;if(i[1]!==c){if(r.skipChecks&&i[1]>c)throw new TypeError("ranges-invert/rInvert(): [THROW_ID_06] The checking (opts.skipChecks) is off and input ranges were not sorted! We nearly wrote range [".concat(i[1],", ").concat(c,"] which is backwards. For investigation, whole ranges array is:\n").concat(u(f)));h.push([i[1],c])}}return C(h,n)}var _="6.2.2";var G=_;function J(e,n,t,r=!1){if(typeof e!="string")throw e===void 0?new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_01] the first input argument must be string! It's missing currently (undefined)!"):new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_02] the first input argument must be string! It was given as:\n".concat(u(e,4)," (type ").concat(typeof e,")"));if(n!=null&&(!Array.isArray(n)||n.length&&!Array.isArray(n[0])))throw new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_03] the second input argument must be array of ranges or null! It was given as:\n".concat(u(n,4)," (type ").concat(typeof n,")"));if(typeof t!="function")throw new Error("ranges-process-outside/rProcessOutside(): [THROW_ID_04] the third input argument must be a function! It was given as:\n".concat(u(t,4)," (type ").concat(typeof t,")"));function l(f,h){let o=new Uint32Array(f.length),i=0;for(let c of f)o[i]=c.length,i+=c.length;(h||[]).forEach(([c,v])=>{for(let y=c;y<v;y++){let d=o[y]||1;t(y,y+d,A=>{A!=null&&(y+=A)}),d&&d>1&&(y+=d-1)}})}if(n!=null&&n.length){let f=C(W(n,e.length,{skipChecks:!!r}),e.length);l(e,f)}else l(e,[[0,e.length]])}return B(K);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-utils
|
|
13
13
|
* @fileoverview Various utility functions
|
|
14
|
-
* @version 1.
|
|
14
|
+
* @version 1.9.0
|
|
15
15
|
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name ranges-sort
|
|
21
21
|
* @fileoverview Sort string index ranges
|
|
22
|
-
* @version 6.2.
|
|
22
|
+
* @version 6.2.1
|
|
23
23
|
* @author Roy Revelt
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/ranges-sort/}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* @name ranges-merge
|
|
29
29
|
* @fileoverview Merge and sort string index ranges
|
|
30
|
-
* @version 9.2.
|
|
30
|
+
* @version 9.2.2
|
|
31
31
|
* @author Roy Revelt
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/ranges-merge/}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
/**
|
|
36
36
|
* @name ranges-crop
|
|
37
37
|
* @fileoverview Crop array of ranges when they go beyond the reference string's length
|
|
38
|
-
* @version 6.2.
|
|
38
|
+
* @version 6.2.2
|
|
39
39
|
* @author Roy Revelt
|
|
40
40
|
* @license MIT
|
|
41
41
|
* {@link https://codsen.com/os/ranges-crop/}
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
/**
|
|
44
44
|
* @name ranges-invert
|
|
45
45
|
* @fileoverview Invert string index ranges
|
|
46
|
-
* @version 6.2.
|
|
46
|
+
* @version 6.2.2
|
|
47
47
|
* @author Roy Revelt
|
|
48
48
|
* @license MIT
|
|
49
49
|
* {@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.2.
|
|
3
|
+
"version": "6.2.2",
|
|
4
4
|
"description": "Iterate string considering ranges, as if they were already applied",
|
|
5
5
|
"keywords": ["array", "indexes", "ranges", "sort", "string"],
|
|
6
6
|
"homepage": "https://codsen.com/os/ranges-process-outside",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"codsen-utils": "^1.
|
|
59
|
-
"ranges-crop": "^6.2.
|
|
60
|
-
"ranges-invert": "^6.2.
|
|
58
|
+
"codsen-utils": "^1.9.0",
|
|
59
|
+
"ranges-crop": "^6.2.2",
|
|
60
|
+
"ranges-invert": "^6.2.2"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=18.20.8"
|