string-left-right 6.2.0 → 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,11 +3,31 @@
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-09-01)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **string-left-right:** align stop helper index types ([21a8768](https://github.com/codsen/codsen/commit/21a876865715da43bb7c20c1f97f6a41ba1078a8))
11
+ - **string-left-right:** bound leftward indexes ([374c8b8](https://github.com/codsen/codsen/commit/374c8b87f44e617151782e7dd9a30420637c917a))
12
+ - **string-left-right:** require sequence successors ([fa8361f](https://github.com/codsen/codsen/commit/fa8361f8bfa79dae471058b1aedff7f65a440843))
13
+ - **string-left-right:** type variadic match arguments ([f20a40a](https://github.com/codsen/codsen/commit/f20a40a3f6230180785b717cc747b8e4af79c3c0))
14
+
15
+ ### Performance Improvements
16
+
17
+ - **string-left-right:** benchmark paired core lookups ([c836bfa](https://github.com/codsen/codsen/commit/c836bfa56a32e995b3c3fa17d470e44dbd2e857f))
18
+ - **string-left-right:** streamline leftward scans ([c6f4a49](https://github.com/codsen/codsen/commit/c6f4a49a864570ed1f04a0dd875456e55c0999d4))
19
+
20
+ ## 6.2.1 (2026-08-22)
21
+
22
+ ### Performance Improvements
23
+
24
+ - optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
25
+
6
26
  ## 6.2.0 (2026-08-19)
7
27
 
8
28
  ### Bug Fixes
9
29
 
10
- - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
30
+ - resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
11
31
  - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
12
32
  - stop case-insensitive matching crashing on a null index ([5682575](https://github.com/codsen/codsen/commit/56825755acdcb8c9f2be089bf13cb24ba032e950))
13
33
  - validate chomp modes and avoid argument cloning ([577224a](https://github.com/codsen/codsen/commit/577224a0d2eb95673872d5e2a5780f0ee9751dc5))
@@ -1,24 +1,21 @@
1
1
  /**
2
2
  * @name string-left-right
3
3
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
4
- * @version 6.2.0
4
+ * @version 6.2.2
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-left-right/}
8
8
  */
9
9
 
10
- import{isInt as R,isPlainObject as h,isStr as p}from"codsen-utils";var O="6.2.0";var j=O,$="\xA0";function L(n){let e={value:n,hungry:!1,optional:!1};return(e.value.endsWith("?*")||e.value.endsWith("*?"))&&e.value.length>2?(e.value=e.value.slice(0,e.value.length-2),e.optional=!0,e.hungry=!0):e.value.endsWith("?")&&e.value.length>1?(e.value=e.value.slice(0,~-e.value.length),e.optional=!0):e.value.endsWith("*")&&e.value.length>1&&(e.value=e.value.slice(0,~-e.value.length),e.hungry=!0),e}function V({str:n,idx:e=0,stopAtNewlines:l=!1,stopAtRawNbsp:o=!1}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),!n[e+1]))return null;if(n[e+1]&&(n[e+1].trim()||l&&`
11
- \r`.includes(n[e+1])||o&&n[e+1]===$))return e+1;if(n[e+2]&&(n[e+2].trim()||l&&`
12
- \r`.includes(n[e+2])||o&&n[e+2]===$))return e+2;for(let t=e+1,m=n.length;t<m;t++)if(n[t].trim()||l&&`
13
- \r`.includes(n[t])||o&&n[t]===$)return t;return null}function y(n,e=0){return V({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function k(n,e){return V({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function W(n,e){return V({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function N({str:n,idx:e,stopAtNewlines:l,stopAtRawNbsp:o}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),e<1))return null;if(n[~-e]&&(n[~-e].trim()||l&&`
14
- \r`.includes(n[~-e])||o&&n[~-e]===$))return~-e;if(n[e-2]&&(n[e-2].trim()||l&&`
15
- \r`.includes(n[e-2])||o&&n[e-2]===$))return e-2;for(let t=e;t--;)if(n[t]&&(n[t].trim()||l&&`
16
- \r`.includes(n[t])||o&&n[t]===$))return t;return null}function D(n,e=0){return N({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function _(n,e){return N({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function M(n,e){return N({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function w(n,e,l,o,t){if(typeof e!="string"||!e.length||(typeof l!="number"&&(l=0),n==="right"&&!e[l+1]||n==="left"&&!e[~-l]))return null;let m=l,u=[],f,i,s,r=0;for(;r<t.length;){if(!p(t[r])||!t[r].length){r+=1;continue}let{value:a,optional:T,hungry:v}=L(t[r]),g=n==="right"?y(e,m):D(e,m),d=e[g];if(d!==void 0&&(o.i&&d.toLowerCase()===a.toLowerCase()||!o.i&&d===a)){let I=n==="right"?y(e,g):D(e,g),S=!1;if(v){let E=e[I];S=E!==void 0&&(o.i&&E.toLowerCase()===a.toLowerCase()||!o.i&&E===a)}S?s=!0:r+=1,typeof g=="number"&&n==="right"&&g>m+1?u.push([m+1,g]):n==="left"&&typeof g=="number"&&g<~-m&&u.unshift([g+1,m]),m=g,n==="right"?(f===void 0&&(f=g),i=g):(i===void 0&&(i=g),f=g)}else if(T)r+=1;else if(s)r+=1,s=void 0;else return null}return f===void 0||i===void 0?null:{gaps:u,leftmostChar:f,rightmostChar:i}}var b={i:!1};function A(n,e,...l){if(!l?.length)throw new Error("string-left-right/leftSeq(): [THROW_ID_01] only two input arguments were passed! Did you intend to use left() method instead?");let o;return h(l[0])?o={...b,...l.shift()}:o=b,w("left",n,e,o,Array.from(l).reverse())}function U(n,e,...l){if(!l?.length)throw new Error("string-left-right/rightSeq(): [THROW_ID_02] only two input arguments were passed! Did you intend to use right() method instead?");let o;return h(l[0])?o={...b,...l.shift()}:o=b,w("right",n,e,o,l)}function c(n,e,l,o,t=[]){if(typeof e!="string"||!e.length||((!l||typeof l!="number")&&(l=0),n==="right"&&!e[l+1]||n==="left"&&+l==0))return null;let m=null,u=null;do m=n==="right"?U(e,typeof u=="number"?u:l,...t):A(e,typeof u=="number"?u:l,...t),m!==null&&(u=n==="right"?m.rightmostChar:m.leftmostChar);while(m);if(u!=null&&n==="right"&&(u+=1),u===null)return null;if(n==="right"){if(e[u]?.trim())return u;let i=y(e,u);if(!o||o.mode===0){if(i===u+1)return u;if(e.slice(u,i||e.length).trim()||e.slice(u,i||e.length).includes(`
17
- `)||e.slice(u,i||e.length).includes("\r")){for(let s=u,r=e.length;s<r;s++)if(`
18
- \r`.includes(e[s]))return s}else return i?~-i:e.length}else{if(o.mode===1)return u;if(o.mode===2){let s=e.slice(u);if(s.trim()||s.includes(`
19
- `)||s.includes("\r")){for(let r=u,a=e.length;r<a;r++)if(e[r].trim()||`
20
- \r`.includes(e[r]))return r}return e.length}}return i||e.length}if(e[u]&&e[~-u]?.trim())return u;let f=D(e,u);if(!o||o.mode===0){if(f===u-2)return u;if(e.slice(0,u).trim()||e.slice(0,u).includes(`
21
- `)||e.slice(0,u).includes("\r")){for(let i=u;i--;)if(`
22
- \r`.includes(e[i])||e[i].trim())return i+1+(e[i].trim()?1:0)}return 0}if(o.mode===1)return u;if(o.mode===2){let i=e.slice(0,u);if(i.trim()||i.includes(`
23
- `)||i.includes("\r")){for(let s=u;s--;)if(e[s].trim()||`
24
- \r`.includes(e[s]))return s+1}return 0}return f!==null?f+1:0}function H(n,e,...l){if(!l.length||l.length===1&&h(l[0]))return null;let o={mode:0};if(h(l[0])){let t={...o,...l[0]};if(!t.mode)t.mode=0;else if(p(t.mode)&&t.mode.length===1&&"0123".includes(t.mode))t.mode=+t.mode;else if(!R(t.mode)||t.mode<0||t.mode>3)throw new Error(`string-left-right/chompLeft(): [THROW_ID_03] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ${t.mode} (type ${typeof t.mode})`);return c("left",n,e,t,l.slice(1))}return p(l[0])?c("left",n,e,o,l):c("left",n,e,o,l.slice(1))}function P(n,e,...l){if(!l.length||l.length===1&&h(l[0]))return null;let o={mode:0};if(h(l[0])){let t={...o,...l[0]};if(!t.mode)t.mode=0;else if(p(t.mode)&&/^[0-3]$/.test(t.mode))t.mode=Number.parseInt(t.mode,10);else if(!R(t.mode)||t.mode<0||t.mode>3)throw new Error(`string-left-right/chompRight(): [THROW_ID_04] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ${t.mode} (type ${typeof t.mode})`);return c("right",n,e,t,l.slice(1))}return p(l[0])?c("right",n,e,o,l):c("right",n,e,o,l.slice(1))}export{H as chompLeft,P as chompRight,D as left,A as leftSeq,_ as leftStopAtNewLines,M as leftStopAtRawNbsp,y as right,U as rightSeq,k as rightStopAtNewLines,W as rightStopAtRawNbsp,j as version};
10
+ import{isInt as R,isPlainObject as h,isStr as p}from"codsen-utils";var N="6.2.2";var W=N,D="\xA0";function $(n){return n===32||n>=9&&n<=13||n===160||n===5760||n>=8192&&n<=8202||n===8232||n===8233||n===8239||n===8287||n===12288||n===65279}function d(n,e){return e==null?0:typeof e!="number"||!Number.isInteger(e)||e<0?null:e>n?n:e}function L(n){let e={value:n,hungry:!1,optional:!1};return(e.value.endsWith("?*")||e.value.endsWith("*?"))&&e.value.length>2?(e.value=e.value.slice(0,e.value.length-2),e.optional=!0,e.hungry=!0):e.value.endsWith("?")&&e.value.length>1?(e.value=e.value.slice(0,~-e.value.length),e.optional=!0):e.value.endsWith("*")&&e.value.length>1&&(e.value=e.value.slice(0,~-e.value.length),e.hungry=!0),e}function v({str:n,idx:e=0,stopAtNewlines:l=!1,stopAtRawNbsp:t=!1}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),!n[e+1]))return null;if(n[e+1]&&(n[e+1].trim()||l&&`
11
+ \r`.includes(n[e+1])||t&&n[e+1]===D))return e+1;if(n[e+2]&&(n[e+2].trim()||l&&`
12
+ \r`.includes(n[e+2])||t&&n[e+2]===D))return e+2;for(let u=e+3,i=n.length;u<i;u++)if(n[u].trim()||l&&`
13
+ \r`.includes(n[u])||t&&n[u]===D)return u;return null}function V(n,e=0){if(typeof n!="string"||!n.length)return null;(!e||typeof e!="number")&&(e=0);let l=n[e+1];if(!l)return null;if(!$(l.charCodeAt(0)))return e+1;if(l=n[e+2],l&&!$(l.charCodeAt(0)))return e+2;for(let t=e+3,u=n.length;t<u;t++)if(!$(n.charCodeAt(t)))return t;return null}function z(n,e=0){return v({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function _(n,e=0){return v({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function w({str:n,idx:e,stopAtNewlines:l,stopAtRawNbsp:t}){if(typeof n!="string"||!n.length)return null;let u=d(n.length,e);if(u===null||u<1)return null;let i=u-1,o=n.charCodeAt(i);if(!$(o)||l&&(o===10||o===13)||t&&o===160)return i;if(i-=1,i<0)return null;if(o=n.charCodeAt(i),!$(o)||l&&(o===10||o===13)||t&&o===160)return i;for(i-=1;i>=0;i--)if(o=n.charCodeAt(i),!$(o)||l&&(o===10||o===13)||t&&o===160)return i;return null}function O(n,e=0){if(typeof n!="string"||!n.length)return null;let l=d(n.length,e);if(l===null||l<1)return null;let t=l-1;if(!$(n.charCodeAt(t)))return t;if(t-=1,t<0)return null;if(!$(n.charCodeAt(t)))return t;for(t-=1;t>=0;t--)if(!$(n.charCodeAt(t)))return t;return null}function M(n,e=0){return w({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function H(n,e=0){return w({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function T(n,e,l,t,u){if(typeof e!="string"||!e.length)return null;if(n==="left"){let a=d(e.length,l);if(a===null)return null;l=a}else typeof l!="number"&&(l=0);if(n==="right"&&!e[l+1]||n==="left"&&!e[~-l])return null;let i=l,o=[],f,r,s,g=0;for(;g<u.length;){if(!p(u[g])||!u[g].length){g+=1;continue}let{value:a,optional:I,hungry:A}=L(u[g]),m=n==="right"?V(e,i):O(e,i),E=e[m];if(E!==void 0&&(t.i&&E.toLowerCase()===a.toLowerCase()||!t.i&&E===a)){let J=n==="right"?V(e,m):O(e,m),S=!1;if(A){let y=e[J];S=y!==void 0&&(t.i&&y.toLowerCase()===a.toLowerCase()||!t.i&&y===a)}S?s=!0:(g+=1,s=void 0),typeof m=="number"&&n==="right"&&m>i+1?o.push([i+1,m]):n==="left"&&typeof m=="number"&&m<~-i&&o.unshift([m+1,i]),i=m,n==="right"?(f===void 0&&(f=m),r=m):(r===void 0&&(r=m),f=m)}else if(I)g+=1;else if(s)g+=1,s=void 0;else return null}return f===void 0||r===void 0?null:{gaps:o,leftmostChar:f,rightmostChar:r}}var b={i:!1};function U(n,e,...l){if(!l?.length)throw new Error("string-left-right/leftSeq(): [THROW_ID_01] only two input arguments were passed! Did you intend to use left() method instead?");let t;return h(l[0])?t={...b,...l.shift()}:t=b,T("left",n,e,t,Array.from(l).reverse())}function C(n,e,...l){if(!l?.length)throw new Error("string-left-right/rightSeq(): [THROW_ID_02] only two input arguments were passed! Did you intend to use right() method instead?");let t;return h(l[0])?t={...b,...l.shift()}:t=b,T("right",n,e,t,l)}function c(n,e,l,t,u=[]){if(typeof e!="string"||!e.length)return null;if(n==="left"){let r=d(e.length,l);if(r===null)return null;l=r}else(!l||typeof l!="number")&&(l=0);if(n==="right"&&!e[l+1]||n==="left"&&+l==0)return null;let i=null,o=null;do i=n==="right"?C(e,typeof o=="number"?o:l,...u):U(e,typeof o=="number"?o:l,...u),i!==null&&(o=n==="right"?i.rightmostChar:i.leftmostChar);while(i);if(o!=null&&n==="right"&&(o+=1),o===null)return null;if(n==="right"){if(e[o]?.trim())return o;let r=V(e,o);if(!t||t.mode===0){if(r===o+1)return o;if(e.slice(o,r||e.length).trim()||e.slice(o,r||e.length).includes(`
14
+ `)||e.slice(o,r||e.length).includes("\r")){for(let s=o,g=e.length;s<g;s++)if(`
15
+ \r`.includes(e[s]))return s}else return r?~-r:e.length}else{if(t.mode===1)return o;if(t.mode===2){let s=e.slice(o);if(s.trim()||s.includes(`
16
+ `)||s.includes("\r")){for(let g=o,a=e.length;g<a;g++)if(e[g].trim()||`
17
+ \r`.includes(e[g]))return g}return e.length}}return r||e.length}if(e[o]&&e[~-o]?.trim())return o;let f=O(e,o);if(!t||t.mode===0){if(f===o-2)return o;if(e.slice(0,o).trim()||e.slice(0,o).includes(`
18
+ `)||e.slice(0,o).includes("\r")){for(let r=o;r--;)if(`
19
+ \r`.includes(e[r])||e[r].trim())return r+1+(e[r].trim()?1:0)}return 0}if(t.mode===1)return o;if(t.mode===2){let r=e.slice(0,o);if(r.trim()||r.includes(`
20
+ `)||r.includes("\r")){for(let s=o;s--;)if(e[s].trim()||`
21
+ \r`.includes(e[s]))return s+1}return 0}return f!==null?f+1:0}function P(n,e,...l){if(!l.length||l.length===1&&h(l[0]))return null;let t={mode:0};if(h(l[0])){let u={...t,...l[0]};if(!u.mode)u.mode=0;else if(p(u.mode)&&u.mode.length===1&&"0123".includes(u.mode))u.mode=+u.mode;else if(!R(u.mode)||u.mode<0||u.mode>3)throw new Error(`string-left-right/chompLeft(): [THROW_ID_03] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ${u.mode} (type ${typeof u.mode})`);return c("left",n,e,u,l.slice(1))}return p(l[0])?c("left",n,e,t,l):c("left",n,e,t,l.slice(1))}function B(n,e,...l){if(!l.length||l.length===1&&h(l[0]))return null;let t={mode:0};if(h(l[0])){let u={...t,...l[0]};if(!u.mode)u.mode=0;else if(p(u.mode)&&/^[0-3]$/.test(u.mode))u.mode=Number.parseInt(u.mode,10);else if(!R(u.mode)||u.mode<0||u.mode>3)throw new Error(`string-left-right/chompRight(): [THROW_ID_04] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ${u.mode} (type ${typeof u.mode})`);return c("right",n,e,u,l.slice(1))}return p(l[0])?c("right",n,e,t,l):c("right",n,e,t,l.slice(1))}export{P as chompLeft,B as chompRight,O as left,U as leftSeq,M as leftStopAtNewLines,H as leftStopAtRawNbsp,V as right,C as rightSeq,z as rightStopAtNewLines,_ as rightStopAtRawNbsp,W as version};
@@ -1,17 +1,25 @@
1
1
  /**
2
2
  * @name string-left-right
3
3
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
4
- * @version 6.2.0
4
+ * @version 6.2.2
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-left-right/}
8
8
  */
9
9
 
10
- "use strict";var stringLeftRight=(()=>{var y=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var T=(t,e,n)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,g=(t,e)=>{for(var n in e||(e={}))I.call(e,n)&&T(t,n,e[n]);if(C)for(var n of C(e))J.call(e,n)&&T(t,n,e[n]);return t};var x=(t,e)=>{for(var n in e)y(t,n,{get:e[n],enumerable:!0})},B=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of M(e))!I.call(t,l)&&l!==n&&y(t,l,{get:()=>e[l],enumerable:!(r=F(e,l))||r.enumerable});return t};var q=t=>B(y({},"__esModule",{value:!0}),t);var X={};x(X,{chompLeft:()=>Z,chompRight:()=>Y,left:()=>v,leftSeq:()=>j,leftStopAtNewLines:()=>G,leftStopAtRawNbsp:()=>K,right:()=>E,rightSeq:()=>U,rightStopAtNewLines:()=>Q,rightStopAtRawNbsp:()=>z,version:()=>_});var ne=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"]);function h(t){if(t==null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}function d(t){return typeof t=="string"}function A(t){return Number.isSafeInteger(t)&&t>=0}var k="6.2.0";var _=k,b="\xA0";function H(t){let e={value:t,hungry:!1,optional:!1};return(e.value.endsWith("?*")||e.value.endsWith("*?"))&&e.value.length>2?(e.value=e.value.slice(0,e.value.length-2),e.optional=!0,e.hungry=!0):e.value.endsWith("?")&&e.value.length>1?(e.value=e.value.slice(0,~-e.value.length),e.optional=!0):e.value.endsWith("*")&&e.value.length>1&&(e.value=e.value.slice(0,~-e.value.length),e.hungry=!0),e}function R({str:t,idx:e=0,stopAtNewlines:n=!1,stopAtRawNbsp:r=!1}){if(typeof t!="string"||!t.length||((!e||typeof e!="number")&&(e=0),!t[e+1]))return null;if(t[e+1]&&(t[e+1].trim()||n&&"\n\r".includes(t[e+1])||r&&t[e+1]===b))return e+1;if(t[e+2]&&(t[e+2].trim()||n&&"\n\r".includes(t[e+2])||r&&t[e+2]===b))return e+2;for(let l=e+1,s=t.length;l<s;l++)if(t[l].trim()||n&&"\n\r".includes(t[l])||r&&t[l]===b)return l;return null}function E(t,e=0){return R({str:t,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Q(t,e){return R({str:t,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function z(t,e){return R({str:t,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function V({str:t,idx:e,stopAtNewlines:n,stopAtRawNbsp:r}){if(typeof t!="string"||!t.length||((!e||typeof e!="number")&&(e=0),e<1))return null;if(t[~-e]&&(t[~-e].trim()||n&&"\n\r".includes(t[~-e])||r&&t[~-e]===b))return~-e;if(t[e-2]&&(t[e-2].trim()||n&&"\n\r".includes(t[e-2])||r&&t[e-2]===b))return e-2;for(let l=e;l--;)if(t[l]&&(t[l].trim()||n&&"\n\r".includes(t[l])||r&&t[l]===b))return l;return null}function v(t,e=0){return V({str:t,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function G(t,e){return V({str:t,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function K(t,e){return V({str:t,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function L(t,e,n,r,l){if(typeof e!="string"||!e.length||(typeof n!="number"&&(n=0),t==="right"&&!e[n+1]||t==="left"&&!e[~-n]))return null;let s=n,i=[],f,p,m,o=0;for(;o<l.length;){if(!d(l[o])||!l[o].length){o+=1;continue}let{value:u,optional:c,hungry:S}=H(l[o]),a=t==="right"?E(e,s):v(e,s),D=e[a];if(D!==void 0&&(r.i&&D.toLowerCase()===u.toLowerCase()||!r.i&&D===u)){let W=t==="right"?E(e,a):v(e,a),N=!1;if(S){let O=e[W];N=O!==void 0&&(r.i&&O.toLowerCase()===u.toLowerCase()||!r.i&&O===u)}N?m=!0:o+=1,typeof a=="number"&&t==="right"&&a>s+1?i.push([s+1,a]):t==="left"&&typeof a=="number"&&a<~-s&&i.unshift([a+1,s]),s=a,t==="right"?(f===void 0&&(f=a),p=a):(p===void 0&&(p=a),f=a)}else if(c)o+=1;else if(m)o+=1,m=void 0;else return null}return f===void 0||p===void 0?null:{gaps:i,leftmostChar:f,rightmostChar:p}}var w={i:!1};function j(t,e,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/leftSeq(): [THROW_ID_01] only two input arguments were passed! Did you intend to use left() method instead?");let r;return h(n[0])?r=g(g({},w),n.shift()):r=w,L("left",t,e,r,Array.from(n).reverse())}function U(t,e,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/rightSeq(): [THROW_ID_02] only two input arguments were passed! Did you intend to use right() method instead?");let r;return h(n[0])?r=g(g({},w),n.shift()):r=w,L("right",t,e,r,n)}function $(t,e,n,r,l=[]){var p,m;if(typeof e!="string"||!e.length||((!n||typeof n!="number")&&(n=0),t==="right"&&!e[n+1]||t==="left"&&+n==0))return null;let s=null,i=null;do s=t==="right"?U(e,typeof i=="number"?i:n,...l):j(e,typeof i=="number"?i:n,...l),s!==null&&(i=t==="right"?s.rightmostChar:s.leftmostChar);while(s);if(i!=null&&t==="right"&&(i+=1),i===null)return null;if(t==="right"){if((p=e[i])!=null&&p.trim())return i;let o=E(e,i);if(!r||r.mode===0){if(o===i+1)return i;if(e.slice(i,o||e.length).trim()||e.slice(i,o||e.length).includes("\n")||e.slice(i,o||e.length).includes("\r")){for(let u=i,c=e.length;u<c;u++)if("\n\r".includes(e[u]))return u}else return o?~-o:e.length}else{if(r.mode===1)return i;if(r.mode===2){let u=e.slice(i);if(u.trim()||u.includes("\n")||u.includes("\r")){for(let c=i,S=e.length;c<S;c++)if(e[c].trim()||"\n\r".includes(e[c]))return c}return e.length}}return o||e.length}if(e[i]&&((m=e[~-i])!=null&&m.trim()))return i;let f=v(e,i);if(!r||r.mode===0){if(f===i-2)return i;if(e.slice(0,i).trim()||e.slice(0,i).includes("\n")||e.slice(0,i).includes("\r")){for(let o=i;o--;)if("\n\r".includes(e[o])||e[o].trim())return o+1+(e[o].trim()?1:0)}return 0}if(r.mode===1)return i;if(r.mode===2){let o=e.slice(0,i);if(o.trim()||o.includes("\n")||o.includes("\r")){for(let u=i;u--;)if(e[u].trim()||"\n\r".includes(e[u]))return u+1}return 0}return f!==null?f+1:0}function Z(t,e,...n){if(!n.length||n.length===1&&h(n[0]))return null;let r={mode:0};if(h(n[0])){let l=g(g({},r),n[0]);if(!l.mode)l.mode=0;else if(d(l.mode)&&l.mode.length===1&&"0123".includes(l.mode))l.mode=+l.mode;else if(!A(l.mode)||l.mode<0||l.mode>3)throw new Error("string-left-right/chompLeft(): [THROW_ID_03] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ".concat(l.mode," (type ").concat(typeof l.mode,")"));return $("left",t,e,l,n.slice(1))}return d(n[0])?$("left",t,e,r,n):$("left",t,e,r,n.slice(1))}function Y(t,e,...n){if(!n.length||n.length===1&&h(n[0]))return null;let r={mode:0};if(h(n[0])){let l=g(g({},r),n[0]);if(!l.mode)l.mode=0;else if(d(l.mode)&&/^[0-3]$/.test(l.mode))l.mode=Number.parseInt(l.mode,10);else if(!A(l.mode)||l.mode<0||l.mode>3)throw new Error("string-left-right/chompRight(): [THROW_ID_04] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ".concat(l.mode," (type ").concat(typeof l.mode,")"));return $("right",t,e,l,n.slice(1))}return d(n[0])?$("right",t,e,r,n):$("right",t,e,r,n.slice(1))}return q(X);})();
10
+ "use strict";var stringLeftRight=(()=>{var y=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var C=(t,e,n)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,c=(t,e)=>{for(var n in e||(e={}))k.call(e,n)&&C(t,n,e[n]);if(j)for(var n of j(e))Q.call(e,n)&&C(t,n,e[n]);return t};var G=(t,e)=>{for(var n in e)y(t,n,{get:e[n],enumerable:!0})},Z=(t,e,n,_)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of K(e))!k.call(t,r)&&r!==n&&y(t,r,{get:()=>e[r],enumerable:!(_=H(e,r))||_.enumerable});return t};var Y=t=>Z(y({},"__esModule",{value:!0}),t);var fe={};G(fe,{chompLeft:()=>se,chompRight:()=>ae,left:()=>v,leftSeq:()=>z,leftStopA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+Number.parseInt(A[t],36),n=e+Number.parseInt(A[t+1],36);ee.push([e,n]),I=n}var de=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 W=Function.prototype.toString,te=W.call(Object);var be=Map.prototype.entries,ye=Set.prototype.values;var T,$e=(T=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:T.get,x,ve=(x=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:x.get,L,Oe=(L=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:L.get,U,we=(U=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:U.get,Ee=RegExp.prototype.test;function m(t){var _;if(t==null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;let n=Object.getOwnPropertyDescriptor(e,"constructor");return!n||!("value"in n)||typeof n.value!="function"?!1:((_=Object.getOwnPropertyDescriptor(n.value,"prototype"))==null?void 0:_.value)===e&&W.call(n.value)===te}function d(t){return typeof t=="string"}function R(t){return Number.isSafeInteger(t)&&t>=0}var De=Date.prototype.getTime;var F="6.2.2";var _e=F,N="\xA0";function g(t){return t===32||t>=9&&t<=13||t===160||t===5760||t>=8192&&t<=8202||t===8232||t===8233||t===8239||t===8287||t===12288||t===65279}function w(t,e){return e==null?0:typeof e!="number"||!Number.isInteger(e)||e<0?null:e>t?t:e}function re(t){let e={value:t,hungry:!1,optional:!1};return(e.value.endsWith("?*")||e.value.endsWith("*?"))&&e.value.length>2?(e.value=e.value.slice(0,e.value.length-2),e.optional=!0,e.hungry=!0):e.value.endsWith("?")&&e.value.length>1?(e.value=e.value.slice(0,~-e.value.length),e.optional=!0):e.value.endsWith("*")&&e.value.length>1&&(e.value=e.value.slice(0,~-e.value.length),e.hungry=!0),e}function q({str:t,idx:e=0,stopAtNewlines:n=!1,stopAtRawNbsp:_=!1}){if(typeof t!="string"||!t.length||((!e||typeof e!="number")&&(e=0),!t[e+1]))return null;if(t[e+1]&&(t[e+1].trim()||n&&"\n\r".includes(t[e+1])||_&&t[e+1]===N))return e+1;if(t[e+2]&&(t[e+2].trim()||n&&"\n\r".includes(t[e+2])||_&&t[e+2]===N))return e+2;for(let r=e+3,o=t.length;r<o;r++)if(t[r].trim()||n&&"\n\r".includes(t[r])||_&&t[r]===N)return r;return null}function $(t,e=0){if(typeof t!="string"||!t.length)return null;(!e||typeof e!="number")&&(e=0);let n=t[e+1];if(!n)return null;if(!g(n.charCodeAt(0)))return e+1;if(n=t[e+2],n&&!g(n.charCodeAt(0)))return e+2;for(let _=e+3,r=t.length;_<r;_++)if(!g(t.charCodeAt(_)))return _;return null}function le(t,e=0){return q({str:t,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function ie(t,e=0){return q({str:t,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function M({str:t,idx:e,stopAtNewlines:n,stopAtRawNbsp:_}){if(typeof t!="string"||!t.length)return null;let r=w(t.length,e);if(r===null||r<1)return null;let o=r-1,l=t.charCodeAt(o);if(!g(l)||n&&(l===10||l===13)||_&&l===160)return o;if(o-=1,o<0)return null;if(l=t.charCodeAt(o),!g(l)||n&&(l===10||l===13)||_&&l===160)return o;for(o-=1;o>=0;o--)if(l=t.charCodeAt(o),!g(l)||n&&(l===10||l===13)||_&&l===160)return o;return null}function v(t,e=0){if(typeof t!="string"||!t.length)return null;let n=w(t.length,e);if(n===null||n<1)return null;let _=n-1;if(!g(t.charCodeAt(_)))return _;if(_-=1,_<0)return null;if(!g(t.charCodeAt(_)))return _;for(_-=1;_>=0;_--)if(!g(t.charCodeAt(_)))return _;return null}function oe(t,e=0){return M({str:t,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function ue(t,e=0){return M({str:t,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function P(t,e,n,_,r){if(typeof e!="string"||!e.length)return null;if(t==="left"){let u=w(e.length,n);if(u===null)return null;n=u}else typeof n!="number"&&(n=0);if(t==="right"&&!e[n+1]||t==="left"&&!e[~-n])return null;let o=n,l=[],a,p,h,i=0;for(;i<r.length;){if(!d(r[i])||!r[i].length){i+=1;continue}let{value:u,optional:f,hungry:E}=re(r[i]),s=t==="right"?$(e,o):v(e,o),D=e[s];if(D!==void 0&&(_.i&&D.toLowerCase()===u.toLowerCase()||!_.i&&D===u)){let B=t==="right"?$(e,s):v(e,s),V=!1;if(E){let S=e[B];V=S!==void 0&&(_.i&&S.toLowerCase()===u.toLowerCase()||!_.i&&S===u)}V?h=!0:(i+=1,h=void 0),typeof s=="number"&&t==="right"&&s>o+1?l.push([o+1,s]):t==="left"&&typeof s=="number"&&s<~-o&&l.unshift([s+1,o]),o=s,t==="right"?(a===void 0&&(a=s),p=s):(p===void 0&&(p=s),a=s)}else if(f)i+=1;else if(h)i+=1,h=void 0;else return null}return a===void 0||p===void 0?null:{gaps:l,leftmostChar:a,rightmostChar:p}}var O={i:!1};function z(t,e,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/leftSeq(): [THROW_ID_01] only two input arguments were passed! Did you intend to use left() method instead?");let _;return m(n[0])?_=c(c({},O),n.shift()):_=O,P("left",t,e,_,Array.from(n).reverse())}function J(t,e,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/rightSeq(): [THROW_ID_02] only two input arguments were passed! Did you intend to use right() method instead?");let _;return m(n[0])?_=c(c({},O),n.shift()):_=O,P("right",t,e,_,n)}function b(t,e,n,_,r=[]){var p,h;if(typeof e!="string"||!e.length)return null;if(t==="left"){let i=w(e.length,n);if(i===null)return null;n=i}else(!n||typeof n!="number")&&(n=0);if(t==="right"&&!e[n+1]||t==="left"&&+n==0)return null;let o=null,l=null;do o=t==="right"?J(e,typeof l=="number"?l:n,...r):z(e,typeof l=="number"?l:n,...r),o!==null&&(l=t==="right"?o.rightmostChar:o.leftmostChar);while(o);if(l!=null&&t==="right"&&(l+=1),l===null)return null;if(t==="right"){if((p=e[l])!=null&&p.trim())return l;let i=$(e,l);if(!_||_.mode===0){if(i===l+1)return l;if(e.slice(l,i||e.length).trim()||e.slice(l,i||e.length).includes("\n")||e.slice(l,i||e.length).includes("\r")){for(let u=l,f=e.length;u<f;u++)if("\n\r".includes(e[u]))return u}else return i?~-i:e.length}else{if(_.mode===1)return l;if(_.mode===2){let u=e.slice(l);if(u.trim()||u.includes("\n")||u.includes("\r")){for(let f=l,E=e.length;f<E;f++)if(e[f].trim()||"\n\r".includes(e[f]))return f}return e.length}}return i||e.length}if(e[l]&&((h=e[~-l])!=null&&h.trim()))return l;let a=v(e,l);if(!_||_.mode===0){if(a===l-2)return l;if(e.slice(0,l).trim()||e.slice(0,l).includes("\n")||e.slice(0,l).includes("\r")){for(let i=l;i--;)if("\n\r".includes(e[i])||e[i].trim())return i+1+(e[i].trim()?1:0)}return 0}if(_.mode===1)return l;if(_.mode===2){let i=e.slice(0,l);if(i.trim()||i.includes("\n")||i.includes("\r")){for(let u=l;u--;)if(e[u].trim()||"\n\r".includes(e[u]))return u+1}return 0}return a!==null?a+1:0}function se(t,e,...n){if(!n.length||n.length===1&&m(n[0]))return null;let _={mode:0};if(m(n[0])){let r=c(c({},_),n[0]);if(!r.mode)r.mode=0;else if(d(r.mode)&&r.mode.length===1&&"0123".includes(r.mode))r.mode=+r.mode;else if(!R(r.mode)||r.mode<0||r.mode>3)throw new Error("string-left-right/chompLeft(): [THROW_ID_03] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ".concat(r.mode," (type ").concat(typeof r.mode,")"));return b("left",t,e,r,n.slice(1))}return d(n[0])?b("left",t,e,_,n):b("left",t,e,_,n.slice(1))}function ae(t,e,...n){if(!n.length||n.length===1&&m(n[0]))return null;let _={mode:0};if(m(n[0])){let r=c(c({},_),n[0]);if(!r.mode)r.mode=0;else if(d(r.mode)&&/^[0-3]$/.test(r.mode))r.mode=Number.parseInt(r.mode,10);else if(!R(r.mode)||r.mode<0||r.mode>3)throw new Error("string-left-right/chompRight(): [THROW_ID_04] the opts.mode is wrong! It should be 0, 1, 2 or 3. It was given as ".concat(r.mode," (type ").concat(typeof r.mode,")"));return b("right",t,e,r,n.slice(1))}return d(n[0])?b("right",t,e,_,n):b("right",t,e,_,n.slice(1))}return Y(fe);})();
11
+ /**
12
+ * @name codsen-format-diagnostic-value
13
+ * @fileoverview Safely format untrusted JavaScript values for diagnostics
14
+ * @version 1.1.0
15
+ * @author Roy Revelt
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-format-diagnostic-value/}
18
+ */
11
19
  /**
12
20
  * @name codsen-utils
13
21
  * @fileoverview Various utility functions
14
- * @version 1.8.0
22
+ * @version 1.10.0
15
23
  * @author Roy Revelt
16
24
  * @license MIT
17
25
  * {@link https://codsen.com/os/codsen-utils/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-left-right",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
4
4
  "description": "Looks up the first non-whitespace character to the left/right of a given index",
5
5
  "keywords": [
6
6
  "check",
@@ -69,7 +69,7 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "codsen-utils": "^1.8.0"
72
+ "codsen-utils": "^1.10.0"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=18.20.8"
package/types/index.d.ts CHANGED
@@ -3,11 +3,23 @@ interface Opts {
3
3
  i?: boolean;
4
4
  }
5
5
  declare function right(str: string, idx?: number | null): number | null;
6
- declare function rightStopAtNewLines(str: string, idx: number): number | null;
7
- declare function rightStopAtRawNbsp(str: string, idx: number): number | null;
6
+ declare function rightStopAtNewLines(
7
+ str: string,
8
+ idx?: number | null,
9
+ ): number | null;
10
+ declare function rightStopAtRawNbsp(
11
+ str: string,
12
+ idx?: number | null,
13
+ ): number | null;
8
14
  declare function left(str: string, idx?: number | null): number | null;
9
- declare function leftStopAtNewLines(str: string, idx: number): number | null;
10
- declare function leftStopAtRawNbsp(str: string, idx: number): number | null;
15
+ declare function leftStopAtNewLines(
16
+ str: string,
17
+ idx?: number | null,
18
+ ): number | null;
19
+ declare function leftStopAtRawNbsp(
20
+ str: string,
21
+ idx?: number | null,
22
+ ): number | null;
11
23
  interface SeqOutput {
12
24
  gaps: [number, number][];
13
25
  leftmostChar: number;
@@ -16,22 +28,33 @@ interface SeqOutput {
16
28
  declare function leftSeq(
17
29
  str: string,
18
30
  idx: number,
19
- ...args: any[]
31
+ ...args:
32
+ | [value: string, ...values: string[]]
33
+ | [opts: Opts, value: string, ...values: string[]]
20
34
  ): SeqOutput | null;
21
35
  declare function rightSeq(
22
36
  str: string,
23
37
  idx: number,
24
- ...args: any[]
38
+ ...args:
39
+ | [value: string, ...values: string[]]
40
+ | [opts: Opts, value: string, ...values: string[]]
25
41
  ): SeqOutput | null;
42
+ interface ChompOpts {
43
+ mode?: 0 | 1 | 2 | 3 | "0" | "1" | "2" | "3" | "" | null;
44
+ }
26
45
  declare function chompLeft(
27
46
  str: string,
28
47
  idx: number,
29
- ...args: any[]
48
+ ...args:
49
+ | [value: string, ...values: string[]]
50
+ | [opts: ChompOpts | null | undefined, value: string, ...values: string[]]
30
51
  ): number | null;
31
52
  declare function chompRight(
32
53
  str: string,
33
54
  idx: number,
34
- ...args: any[]
55
+ ...args:
56
+ | [value: string, ...values: string[]]
57
+ | [opts: ChompOpts | null | undefined, value: string, ...values: string[]]
35
58
  ): number | null;
36
59
 
37
60
  export {