string-left-right 6.0.20 → 6.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name string-left-right
|
|
3
3
|
* @fileoverview Looks up the first non-whitespace character to the left/right of a given index
|
|
4
|
-
* @version 6.0.
|
|
4
|
+
* @version 6.0.21
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/string-left-right/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{isPlainObject as p,isStr as b,isInt as R}from"codsen-utils";import I from"rfdc";var S="6.0.
|
|
10
|
+
import{isPlainObject as p,isStr as b,isInt as R}from"codsen-utils";import I from"rfdc";var S="6.0.21";var $=I(),j=S,c="\xA0";function J(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 D({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
11
|
\r`.includes(n[e+1])||o&&n[e+1]===c))return e+1;if(n[e+2]&&(n[e+2].trim()||l&&`
|
|
12
12
|
\r`.includes(n[e+2])||o&&n[e+2]===c))return e+2;for(let t=e+1,m=n.length;t<m;t++)if(n[t].trim()||l&&`
|
|
13
13
|
\r`.includes(n[t])||o&&n[t]===c)return t;return null}function E(n,e=0){return D({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function k(n,e){return D({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function M(n,e){return D({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function V({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&&`
|
|
@@ -1,13 +1,13 @@
|
|
|
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.0.
|
|
4
|
+
* @version 6.0.21
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/string-left-right/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var stringLeftRight=(()=>{var H=Object.create;var O=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var j=(n,e,t)=>e in n?O(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,p=(n,e)=>{for(var t in e||(e={}))I.call(e,t)&&j(n,t,e[t]);if(C)for(var t of C(e))_.call(e,t)&&j(n,t,e[t]);return n};var K=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Z=(n,e)=>{for(var t in e)O(n,t,{get:e[t],enumerable:!0})},L=(n,e,t,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of x(e))!I.call(n,l)&&l!==t&&O(n,l,{get:()=>e[l],enumerable:!(u=W(e,l))||u.enumerable});return n};var F=(n,e,t)=>(t=n!=null?H(Q(n)):{},L(e||!n||!n.__esModule?O(t,"default",{value:n,enumerable:!0}):t,n)),z=n=>L(O({},"__esModule",{value:!0}),n);var A=K((ae,k)=>{"use strict";k.exports=G;function d(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function G(n){if(n=n||{},n.circles)return Y(n);let e=new Map;if(e.set(Date,r=>new Date(r)),e.set(Map,(r,a)=>new Map(u(Array.from(r),a))),e.set(Set,(r,a)=>new Set(u(Array.from(r),a))),n.constructorHandlers)for(let r of n.constructorHandlers)e.set(r[0],r[1]);let t=null;return n.proto?m:l;function u(r,a){let o=Object.keys(r),s=new Array(o.length);for(let c=0;c<o.length;c++){let i=o[c],f=r[i];typeof f!="object"||f===null?s[i]=f:f.constructor!==Object&&(t=e.get(f.constructor))?s[i]=t(f,a):ArrayBuffer.isView(f)?s[i]=d(f):s[i]=a(f)}return s}function l(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return u(r,l);if(r.constructor!==Object&&(t=e.get(r.constructor)))return t(r,l);let a={};for(let o in r){if(Object.hasOwnProperty.call(r,o)===!1)continue;let s=r[o];typeof s!="object"||s===null?a[o]=s:s.constructor!==Object&&(t=e.get(s.constructor))?a[o]=t(s,l):ArrayBuffer.isView(s)?a[o]=d(s):a[o]=l(s)}return a}function m(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return u(r,m);if(r.constructor!==Object&&(t=e.get(r.constructor)))return t(r,m);let a={};for(let o in r){let s=r[o];typeof s!="object"||s===null?a[o]=s:s.constructor!==Object&&(t=e.get(s.constructor))?a[o]=t(s,m):ArrayBuffer.isView(s)?a[o]=d(s):a[o]=m(s)}return a}}function Y(n){let e=[],t=[],u=new Map;if(u.set(Date,o=>new Date(o)),u.set(Map,(o,s)=>new Map(m(Array.from(o),s))),u.set(Set,(o,s)=>new Set(m(Array.from(o),s))),n.constructorHandlers)for(let o of n.constructorHandlers)u.set(o[0],o[1]);let l=null;return n.proto?a:r;function m(o,s){let c=Object.keys(o),i=new Array(c.length);for(let f=0;f<c.length;f++){let h=c[f],g=o[h];if(typeof g!="object"||g===null)i[h]=g;else if(g.constructor!==Object&&(l=u.get(g.constructor)))i[h]=l(g,s);else if(ArrayBuffer.isView(g))i[h]=d(g);else{let w=e.indexOf(g);w!==-1?i[h]=t[w]:i[h]=s(g)}}return i}function r(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return m(o,r);if(o.constructor!==Object&&(l=u.get(o.constructor)))return l(o,r);let s={};e.push(o),t.push(s);for(let c in o){if(Object.hasOwnProperty.call(o,c)===!1)continue;let i=o[c];if(typeof i!="object"||i===null)s[c]=i;else if(i.constructor!==Object&&(l=u.get(i.constructor)))s[c]=l(i,r);else if(ArrayBuffer.isView(i))s[c]=d(i);else{let f=e.indexOf(i);f!==-1?s[c]=t[f]:s[c]=r(i)}}return e.pop(),t.pop(),s}function a(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return m(o,a);if(o.constructor!==Object&&(l=u.get(o.constructor)))return l(o,a);let s={};e.push(o),t.push(s);for(let c in o){let i=o[c];if(typeof i!="object"||i===null)s[c]=i;else if(i.constructor!==Object&&(l=u.get(i.constructor)))s[c]=l(i,a);else if(ArrayBuffer.isView(i))s[c]=d(i);else{let f=e.indexOf(i);f!==-1?s[c]=t[f]:s[c]=a(i)}}return e.pop(),t.pop(),s}}});var ie={};Z(ie,{chompLeft:()=>ue,chompRight:()=>se,left:()=>V,leftSeq:()=>M,leftStopAtNewLines:()=>le,leftStopAtRawNbsp:()=>oe,right:()=>S,rightSeq:()=>P,rightStopAtNewLines:()=>te,rightStopAtRawNbsp:()=>re,version:()=>ee});var J=F(A(),1);var fe=(0,J.default)();function b(n){if(n==null||typeof n!="object")return!1;let e=Object.getPrototypeOf(n);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:!(Symbol.iterator in n)&&!(Symbol.toStringTag in n)}function y(n){return typeof n=="string"}function R(n){return Number.isSafeInteger(n)&&n>=0}var B=F(A(),1);var U="6.0.
|
|
10
|
+
"use strict";var stringLeftRight=(()=>{var H=Object.create;var O=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var j=(n,e,t)=>e in n?O(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,p=(n,e)=>{for(var t in e||(e={}))I.call(e,t)&&j(n,t,e[t]);if(C)for(var t of C(e))_.call(e,t)&&j(n,t,e[t]);return n};var K=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Z=(n,e)=>{for(var t in e)O(n,t,{get:e[t],enumerable:!0})},L=(n,e,t,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of x(e))!I.call(n,l)&&l!==t&&O(n,l,{get:()=>e[l],enumerable:!(u=W(e,l))||u.enumerable});return n};var F=(n,e,t)=>(t=n!=null?H(Q(n)):{},L(e||!n||!n.__esModule?O(t,"default",{value:n,enumerable:!0}):t,n)),z=n=>L(O({},"__esModule",{value:!0}),n);var A=K((ae,k)=>{"use strict";k.exports=G;function d(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function G(n){if(n=n||{},n.circles)return Y(n);let e=new Map;if(e.set(Date,r=>new Date(r)),e.set(Map,(r,a)=>new Map(u(Array.from(r),a))),e.set(Set,(r,a)=>new Set(u(Array.from(r),a))),n.constructorHandlers)for(let r of n.constructorHandlers)e.set(r[0],r[1]);let t=null;return n.proto?m:l;function u(r,a){let o=Object.keys(r),s=new Array(o.length);for(let c=0;c<o.length;c++){let i=o[c],f=r[i];typeof f!="object"||f===null?s[i]=f:f.constructor!==Object&&(t=e.get(f.constructor))?s[i]=t(f,a):ArrayBuffer.isView(f)?s[i]=d(f):s[i]=a(f)}return s}function l(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return u(r,l);if(r.constructor!==Object&&(t=e.get(r.constructor)))return t(r,l);let a={};for(let o in r){if(Object.hasOwnProperty.call(r,o)===!1)continue;let s=r[o];typeof s!="object"||s===null?a[o]=s:s.constructor!==Object&&(t=e.get(s.constructor))?a[o]=t(s,l):ArrayBuffer.isView(s)?a[o]=d(s):a[o]=l(s)}return a}function m(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return u(r,m);if(r.constructor!==Object&&(t=e.get(r.constructor)))return t(r,m);let a={};for(let o in r){let s=r[o];typeof s!="object"||s===null?a[o]=s:s.constructor!==Object&&(t=e.get(s.constructor))?a[o]=t(s,m):ArrayBuffer.isView(s)?a[o]=d(s):a[o]=m(s)}return a}}function Y(n){let e=[],t=[],u=new Map;if(u.set(Date,o=>new Date(o)),u.set(Map,(o,s)=>new Map(m(Array.from(o),s))),u.set(Set,(o,s)=>new Set(m(Array.from(o),s))),n.constructorHandlers)for(let o of n.constructorHandlers)u.set(o[0],o[1]);let l=null;return n.proto?a:r;function m(o,s){let c=Object.keys(o),i=new Array(c.length);for(let f=0;f<c.length;f++){let h=c[f],g=o[h];if(typeof g!="object"||g===null)i[h]=g;else if(g.constructor!==Object&&(l=u.get(g.constructor)))i[h]=l(g,s);else if(ArrayBuffer.isView(g))i[h]=d(g);else{let w=e.indexOf(g);w!==-1?i[h]=t[w]:i[h]=s(g)}}return i}function r(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return m(o,r);if(o.constructor!==Object&&(l=u.get(o.constructor)))return l(o,r);let s={};e.push(o),t.push(s);for(let c in o){if(Object.hasOwnProperty.call(o,c)===!1)continue;let i=o[c];if(typeof i!="object"||i===null)s[c]=i;else if(i.constructor!==Object&&(l=u.get(i.constructor)))s[c]=l(i,r);else if(ArrayBuffer.isView(i))s[c]=d(i);else{let f=e.indexOf(i);f!==-1?s[c]=t[f]:s[c]=r(i)}}return e.pop(),t.pop(),s}function a(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return m(o,a);if(o.constructor!==Object&&(l=u.get(o.constructor)))return l(o,a);let s={};e.push(o),t.push(s);for(let c in o){let i=o[c];if(typeof i!="object"||i===null)s[c]=i;else if(i.constructor!==Object&&(l=u.get(i.constructor)))s[c]=l(i,a);else if(ArrayBuffer.isView(i))s[c]=d(i);else{let f=e.indexOf(i);f!==-1?s[c]=t[f]:s[c]=a(i)}}return e.pop(),t.pop(),s}}});var ie={};Z(ie,{chompLeft:()=>ue,chompRight:()=>se,left:()=>V,leftSeq:()=>M,leftStopAtNewLines:()=>le,leftStopAtRawNbsp:()=>oe,right:()=>S,rightSeq:()=>P,rightStopAtNewLines:()=>te,rightStopAtRawNbsp:()=>re,version:()=>ee});var J=F(A(),1);var fe=(0,J.default)();function b(n){if(n==null||typeof n!="object")return!1;let e=Object.getPrototypeOf(n);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:!(Symbol.iterator in n)&&!(Symbol.toStringTag in n)}function y(n){return typeof n=="string"}function R(n){return Number.isSafeInteger(n)&&n>=0}var B=F(A(),1);var U="6.0.21";var $=(0,B.default)(),ee=U,E="\xA0";function ne(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 T({str:n,idx:e=0,stopAtNewlines:t=!1,stopAtRawNbsp:u=!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()||t&&`
|
|
11
11
|
\r`.includes(n[e+1])||u&&n[e+1]===E))return e+1;if(n[e+2]&&(n[e+2].trim()||t&&`
|
|
12
12
|
\r`.includes(n[e+2])||u&&n[e+2]===E))return e+2;for(let l=e+1,m=n.length;l<m;l++)if(n[l].trim()||t&&`
|
|
13
13
|
\r`.includes(n[l])||u&&n[l]===E)return l;return null}function S(n,e=0){return T({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function te(n,e){return T({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function re(n,e){return T({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function v({str:n,idx:e,stopAtNewlines:t,stopAtRawNbsp:u}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),e<1))return null;if(n[~-e]&&(n[~-e].trim()||t&&`
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
/**
|
|
26
26
|
* @name codsen-utils
|
|
27
27
|
* @fileoverview Various utility functions
|
|
28
|
-
* @version 1.6.
|
|
28
|
+
* @version 1.6.8
|
|
29
29
|
* @author Roy Revelt, Codsen Ltd
|
|
30
30
|
* @license MIT
|
|
31
31
|
* {@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.0.
|
|
3
|
+
"version": "6.0.21",
|
|
4
4
|
"description": "Looks up the first non-whitespace character to the left/right of a given index",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"codsen-utils": "^1.6.
|
|
76
|
+
"codsen-utils": "^1.6.8",
|
|
77
77
|
"rfdc": "^1.4.1"
|
|
78
78
|
}
|
|
79
79
|
}
|