ranges-process-outside 6.1.3 → 6.2.1
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 +18 -2
- package/LICENSE +1 -1
- package/README.md +3 -2
- package/dist/ranges-process-outside.esm.js +5 -5
- package/dist/ranges-process-outside.umd.js +14 -6
- package/package.json +23 -33
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,27 @@
|
|
|
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.
|
|
6
|
+
## 6.2.0 (2026-08-19)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
|
|
11
|
+
- resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
|
|
12
|
+
- retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
|
|
7
13
|
|
|
8
14
|
### Features
|
|
9
15
|
|
|
10
|
-
-
|
|
16
|
+
- add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
|
|
17
|
+
- refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
|
|
18
|
+
|
|
19
|
+
### Performance Improvements
|
|
20
|
+
|
|
21
|
+
- precompute rune lengths before iterating ranges ([31f4f3f](https://github.com/codsen/codsen/commit/31f4f3f43b2a74e7169c4ac3d35f39867af20304))
|
|
22
|
+
|
|
23
|
+
### Reverts
|
|
24
|
+
|
|
25
|
+
- Revert "Merge pull request #128 from codsen/release/npm-32198404552-1" ([5baeeaa](https://github.com/codsen/codsen/commit/5baeeaaa677b86f1eaa6396cadf3aea32b06416e)), closes [#128](https://github.com/codsen/codsen/issues/128)
|
|
26
|
+
- Revert "Merge pull request #127 from codsen/release/npm-32194020886-1" ([5f1e94d](https://github.com/codsen/codsen/commit/5f1e94deef910ce735266b16aeee08a76de7a862)), closes [#127](https://github.com/codsen/codsen/issues/127)
|
|
11
27
|
|
|
12
28
|
## 6.0.0 (2022-12-01)
|
|
13
29
|
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright © 2010-
|
|
3
|
+
Copyright © 2010-2026 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
|
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ npm i ranges-process-outside
|
|
|
32
32
|
## Quick Take
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
|
-
import { strict as assert } from "assert";
|
|
35
|
+
import { strict as assert } from "node:assert";
|
|
36
36
|
|
|
37
37
|
import { rProcessOutside } from "ranges-process-outside";
|
|
38
38
|
|
|
@@ -52,6 +52,7 @@ rProcessOutside(
|
|
|
52
52
|
assert.deepEqual(gathered, [0, 5, 6, 7, 8, 9]);
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
|
|
55
56
|
## Documentation
|
|
56
57
|
|
|
57
58
|
Please [visit codsen.com](https://codsen.com/os/ranges-process-outside/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/ranges-process-outside/CHANGELOG.md).
|
|
@@ -64,6 +65,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
64
65
|
|
|
65
66
|
MIT License
|
|
66
67
|
|
|
67
|
-
Copyright © 2010-
|
|
68
|
+
Copyright © 2010-2026 Roy Revelt and other contributors
|
|
68
69
|
|
|
69
70
|
<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.1
|
|
4
|
+
* @version 6.2.1
|
|
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
|
|
11
|
-
${
|
|
12
|
-
${
|
|
13
|
-
${
|
|
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.1";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
|
+
${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
|
+
${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
|
+
${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,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ranges-process-outside
|
|
3
3
|
* @fileoverview Iterate string considering ranges, as if they were already applied
|
|
4
|
-
* @version 6.1
|
|
4
|
+
* @version 6.2.1
|
|
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 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.1.3";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 $=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);})();
|
|
11
|
+
/**
|
|
12
|
+
* @name codsen-utils
|
|
13
|
+
* @fileoverview Various utility functions
|
|
14
|
+
* @version 1.8.0
|
|
15
|
+
* @author Roy Revelt
|
|
16
|
+
* @license MIT
|
|
17
|
+
* {@link https://codsen.com/os/codsen-utils/}
|
|
18
|
+
*/
|
|
11
19
|
/**
|
|
12
20
|
* @name ranges-sort
|
|
13
21
|
* @fileoverview Sort string index ranges
|
|
14
|
-
* @version 6.
|
|
22
|
+
* @version 6.2.0
|
|
15
23
|
* @author Roy Revelt
|
|
16
24
|
* @license MIT
|
|
17
25
|
* {@link https://codsen.com/os/ranges-sort/}
|
|
@@ -19,7 +27,7 @@
|
|
|
19
27
|
/**
|
|
20
28
|
* @name ranges-merge
|
|
21
29
|
* @fileoverview Merge and sort string index ranges
|
|
22
|
-
* @version 9.1
|
|
30
|
+
* @version 9.2.1
|
|
23
31
|
* @author Roy Revelt
|
|
24
32
|
* @license MIT
|
|
25
33
|
* {@link https://codsen.com/os/ranges-merge/}
|
|
@@ -27,7 +35,7 @@
|
|
|
27
35
|
/**
|
|
28
36
|
* @name ranges-crop
|
|
29
37
|
* @fileoverview Crop array of ranges when they go beyond the reference string's length
|
|
30
|
-
* @version 6.1
|
|
38
|
+
* @version 6.2.1
|
|
31
39
|
* @author Roy Revelt
|
|
32
40
|
* @license MIT
|
|
33
41
|
* {@link https://codsen.com/os/ranges-crop/}
|
|
@@ -35,7 +43,7 @@
|
|
|
35
43
|
/**
|
|
36
44
|
* @name ranges-invert
|
|
37
45
|
* @fileoverview Invert string index ranges
|
|
38
|
-
* @version 6.1
|
|
46
|
+
* @version 6.2.1
|
|
39
47
|
* @author Roy Revelt
|
|
40
48
|
* @license MIT
|
|
41
49
|
* {@link https://codsen.com/os/ranges-invert/}
|
package/package.json
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ranges-process-outside",
|
|
3
|
-
"version": "6.1
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "Iterate string considering ranges, as if they were already applied",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"array",
|
|
7
|
-
"indexes",
|
|
8
|
-
"ranges",
|
|
9
|
-
"sort",
|
|
10
|
-
"string"
|
|
11
|
-
],
|
|
5
|
+
"keywords": ["array", "indexes", "ranges", "sort", "string"],
|
|
12
6
|
"homepage": "https://codsen.com/os/ranges-process-outside",
|
|
13
7
|
"repository": {
|
|
14
8
|
"type": "git",
|
|
@@ -29,48 +23,44 @@
|
|
|
29
23
|
},
|
|
30
24
|
"types": "types/index.d.ts",
|
|
31
25
|
"scripts": {
|
|
32
|
-
"build": "node
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
|
|
26
|
+
"build": "node ../../ops/scripts/esbuild.js && npm run dts",
|
|
27
|
+
"coverage": "c8 uvu test",
|
|
28
|
+
"dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
|
|
36
29
|
"devtest": "c8 npm run unit && npm run examples && npm run lint",
|
|
37
|
-
"dts": "rollup -c &&
|
|
30
|
+
"dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
|
|
38
31
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
39
|
-
"lect": "node '../../ops/lect/lect.js'
|
|
40
|
-
"
|
|
41
|
-
"lint": "
|
|
32
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
33
|
+
"lect:check": "node '../../ops/lect/lect.js' --check",
|
|
34
|
+
"lint": "biome lint --error-on-warnings . && npm run typecheck",
|
|
35
|
+
"lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
|
|
42
36
|
"perf": "node perf/check.js",
|
|
43
37
|
"prep": "echo 'ready'",
|
|
44
|
-
"prettier": "
|
|
45
|
-
"prettier:format": "
|
|
46
|
-
"pretest": "npm run lect && npm run build",
|
|
38
|
+
"prettier": "biome format",
|
|
39
|
+
"prettier:format": "biome format --write .",
|
|
40
|
+
"pretest": "npm run lect:check && npm run build",
|
|
47
41
|
"test": "npm run devtest",
|
|
42
|
+
"typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
|
|
48
43
|
"unit": "uvu test"
|
|
49
44
|
},
|
|
50
|
-
"engines": {
|
|
51
|
-
"node": ">=14.18.0"
|
|
52
|
-
},
|
|
53
45
|
"c8": {
|
|
46
|
+
"all": true,
|
|
54
47
|
"check-coverage": true,
|
|
55
|
-
"exclude": [
|
|
56
|
-
|
|
57
|
-
],
|
|
48
|
+
"exclude": ["**/test/**/*.*"],
|
|
49
|
+
"include": ["dist/*.esm.js"],
|
|
58
50
|
"lines": 100
|
|
59
51
|
},
|
|
60
52
|
"lect": {
|
|
61
53
|
"licence": {
|
|
62
|
-
"extras": [
|
|
63
|
-
""
|
|
64
|
-
]
|
|
54
|
+
"extras": [""]
|
|
65
55
|
}
|
|
66
56
|
},
|
|
67
57
|
"dependencies": {
|
|
68
|
-
"
|
|
69
|
-
"ranges-
|
|
70
|
-
"
|
|
58
|
+
"codsen-utils": "^1.8.0",
|
|
59
|
+
"ranges-crop": "^6.2.1",
|
|
60
|
+
"ranges-invert": "^6.2.1"
|
|
71
61
|
},
|
|
72
|
-
"
|
|
73
|
-
"
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=18.20.8"
|
|
74
64
|
},
|
|
75
65
|
"publishConfig": {
|
|
76
66
|
"registry": "https://registry.npmjs.org/"
|