string-left-right 6.0.14 → 6.0.15
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.15
|
|
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.15";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.15
|
|
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 x=Object.create;var w=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols,H=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var I=(n,e,l)=>e in n?w(n,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[e]=l,p=(n,e)=>{for(var l in e||(e={}))L.call(e,l)&&I(n,l,e[l]);if(C)for(var l of C(e))K.call(e,l)&&I(n,l,e[l]);return n};var Z=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),z=(n,e)=>{for(var l in e)w(n,l,{get:e[l],enumerable:!0})},j=(n,e,l,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of _(e))!L.call(n,r)&&r!==l&&w(n,r,{get:()=>e[r],enumerable:!(i=Q(e,r))||i.enumerable});return n};var F=(n,e,l)=>(l=n!=null?x(H(n)):{},j(e||!n||!n.__esModule?w(l,"default",{value:n,enumerable:!0}):l,n)),G=n=>j(w({},"__esModule",{value:!0}),n);var V=Z((fe,J)=>{"use strict";J.exports=Y;function d(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function Y(n){if(n=n||{},n.circles)return X(n);return n.proto?i:l;function e(r,a){for(var t=Object.keys(r),o=new Array(t.length),f=0;f<t.length;f++){var s=t[f],u=r[s];typeof u!="object"||u===null?o[s]=u:u instanceof Date?o[s]=new Date(u):ArrayBuffer.isView(u)?o[s]=d(u):o[s]=a(u)}return o}function l(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,l);if(r instanceof Map)return new Map(e(Array.from(r),l));if(r instanceof Set)return new Set(e(Array.from(r),l));var a={};for(var t in r)if(Object.hasOwnProperty.call(r,t)!==!1){var o=r[t];typeof o!="object"||o===null?a[t]=o:o instanceof Date?a[t]=new Date(o):o instanceof Map?a[t]=new Map(e(Array.from(o),l)):o instanceof Set?a[t]=new Set(e(Array.from(o),l)):ArrayBuffer.isView(o)?a[t]=d(o):a[t]=l(o)}return a}function i(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,i);if(r instanceof Map)return new Map(e(Array.from(r),i));if(r instanceof Set)return new Set(e(Array.from(r),i));var a={};for(var t in r){var o=r[t];typeof o!="object"||o===null?a[t]=o:o instanceof Date?a[t]=new Date(o):o instanceof Map?a[t]=new Map(e(Array.from(o),i)):o instanceof Set?a[t]=new Set(e(Array.from(o),i)):ArrayBuffer.isView(o)?a[t]=d(o):a[t]=i(o)}return a}}function X(n){var e=[],l=[];return n.proto?a:r;function i(t,o){for(var f=Object.keys(t),s=new Array(f.length),u=0;u<f.length;u++){var m=f[u],c=t[m];if(typeof c!="object"||c===null)s[m]=c;else if(c instanceof Date)s[m]=new Date(c);else if(ArrayBuffer.isView(c))s[m]=d(c);else{var b=e.indexOf(c);b!==-1?s[m]=l[b]:s[m]=o(c)}}return s}function r(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,r);if(t instanceof Map)return new Map(i(Array.from(t),r));if(t instanceof Set)return new Set(i(Array.from(t),r));var o={};e.push(t),l.push(o);for(var f in t)if(Object.hasOwnProperty.call(t,f)!==!1){var s=t[f];if(typeof s!="object"||s===null)o[f]=s;else if(s instanceof Date)o[f]=new Date(s);else if(s instanceof Map)o[f]=new Map(i(Array.from(s),r));else if(s instanceof Set)o[f]=new Set(i(Array.from(s),r));else if(ArrayBuffer.isView(s))o[f]=d(s);else{var u=e.indexOf(s);u!==-1?o[f]=l[u]:o[f]=r(s)}}return e.pop(),l.pop(),o}function a(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,a);if(t instanceof Map)return new Map(i(Array.from(t),a));if(t instanceof Set)return new Set(i(Array.from(t),a));var o={};e.push(t),l.push(o);for(var f in t){var s=t[f];if(typeof s!="object"||s===null)o[f]=s;else if(s instanceof Date)o[f]=new Date(s);else if(s instanceof Map)o[f]=new Map(i(Array.from(s),a));else if(s instanceof Set)o[f]=new Set(i(Array.from(s),a));else if(ArrayBuffer.isView(s))o[f]=d(s);else{var u=e.indexOf(s);u!==-1?o[f]=l[u]:o[f]=a(s)}}return e.pop(),l.pop(),o}}});var ue={};z(ue,{chompLeft:()=>ie,chompRight:()=>se,left:()=>A,leftSeq:()=>P,leftStopAtNewLines:()=>re,leftStopAtRawNbsp:()=>oe,right:()=>S,rightSeq:()=>W,rightStopAtNewLines:()=>te,rightStopAtRawNbsp:()=>le,version:()=>ee});var M=F(V(),1);var me=(0,M.default)();function $(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 O(n){return Number.isSafeInteger(n)&&n>=0}var B=F(V(),1);var U="6.0.
|
|
10
|
+
"use strict";var stringLeftRight=(()=>{var x=Object.create;var w=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols,H=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var I=(n,e,l)=>e in n?w(n,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[e]=l,p=(n,e)=>{for(var l in e||(e={}))L.call(e,l)&&I(n,l,e[l]);if(C)for(var l of C(e))K.call(e,l)&&I(n,l,e[l]);return n};var Z=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),z=(n,e)=>{for(var l in e)w(n,l,{get:e[l],enumerable:!0})},j=(n,e,l,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of _(e))!L.call(n,r)&&r!==l&&w(n,r,{get:()=>e[r],enumerable:!(i=Q(e,r))||i.enumerable});return n};var F=(n,e,l)=>(l=n!=null?x(H(n)):{},j(e||!n||!n.__esModule?w(l,"default",{value:n,enumerable:!0}):l,n)),G=n=>j(w({},"__esModule",{value:!0}),n);var V=Z((fe,J)=>{"use strict";J.exports=Y;function d(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function Y(n){if(n=n||{},n.circles)return X(n);return n.proto?i:l;function e(r,a){for(var t=Object.keys(r),o=new Array(t.length),f=0;f<t.length;f++){var s=t[f],u=r[s];typeof u!="object"||u===null?o[s]=u:u instanceof Date?o[s]=new Date(u):ArrayBuffer.isView(u)?o[s]=d(u):o[s]=a(u)}return o}function l(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,l);if(r instanceof Map)return new Map(e(Array.from(r),l));if(r instanceof Set)return new Set(e(Array.from(r),l));var a={};for(var t in r)if(Object.hasOwnProperty.call(r,t)!==!1){var o=r[t];typeof o!="object"||o===null?a[t]=o:o instanceof Date?a[t]=new Date(o):o instanceof Map?a[t]=new Map(e(Array.from(o),l)):o instanceof Set?a[t]=new Set(e(Array.from(o),l)):ArrayBuffer.isView(o)?a[t]=d(o):a[t]=l(o)}return a}function i(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,i);if(r instanceof Map)return new Map(e(Array.from(r),i));if(r instanceof Set)return new Set(e(Array.from(r),i));var a={};for(var t in r){var o=r[t];typeof o!="object"||o===null?a[t]=o:o instanceof Date?a[t]=new Date(o):o instanceof Map?a[t]=new Map(e(Array.from(o),i)):o instanceof Set?a[t]=new Set(e(Array.from(o),i)):ArrayBuffer.isView(o)?a[t]=d(o):a[t]=i(o)}return a}}function X(n){var e=[],l=[];return n.proto?a:r;function i(t,o){for(var f=Object.keys(t),s=new Array(f.length),u=0;u<f.length;u++){var m=f[u],c=t[m];if(typeof c!="object"||c===null)s[m]=c;else if(c instanceof Date)s[m]=new Date(c);else if(ArrayBuffer.isView(c))s[m]=d(c);else{var b=e.indexOf(c);b!==-1?s[m]=l[b]:s[m]=o(c)}}return s}function r(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,r);if(t instanceof Map)return new Map(i(Array.from(t),r));if(t instanceof Set)return new Set(i(Array.from(t),r));var o={};e.push(t),l.push(o);for(var f in t)if(Object.hasOwnProperty.call(t,f)!==!1){var s=t[f];if(typeof s!="object"||s===null)o[f]=s;else if(s instanceof Date)o[f]=new Date(s);else if(s instanceof Map)o[f]=new Map(i(Array.from(s),r));else if(s instanceof Set)o[f]=new Set(i(Array.from(s),r));else if(ArrayBuffer.isView(s))o[f]=d(s);else{var u=e.indexOf(s);u!==-1?o[f]=l[u]:o[f]=r(s)}}return e.pop(),l.pop(),o}function a(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,a);if(t instanceof Map)return new Map(i(Array.from(t),a));if(t instanceof Set)return new Set(i(Array.from(t),a));var o={};e.push(t),l.push(o);for(var f in t){var s=t[f];if(typeof s!="object"||s===null)o[f]=s;else if(s instanceof Date)o[f]=new Date(s);else if(s instanceof Map)o[f]=new Map(i(Array.from(s),a));else if(s instanceof Set)o[f]=new Set(i(Array.from(s),a));else if(ArrayBuffer.isView(s))o[f]=d(s);else{var u=e.indexOf(s);u!==-1?o[f]=l[u]:o[f]=a(s)}}return e.pop(),l.pop(),o}}});var ue={};z(ue,{chompLeft:()=>ie,chompRight:()=>se,left:()=>A,leftSeq:()=>P,leftStopAtNewLines:()=>re,leftStopAtRawNbsp:()=>oe,right:()=>S,rightSeq:()=>W,rightStopAtNewLines:()=>te,rightStopAtRawNbsp:()=>le,version:()=>ee});var M=F(V(),1);var me=(0,M.default)();function $(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 O(n){return Number.isSafeInteger(n)&&n>=0}var B=F(V(),1);var U="6.0.15";var h=(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 N({str:n,idx:e=0,stopAtNewlines:l=!1,stopAtRawNbsp:i=!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])||i&&n[e+1]===E))return e+1;if(n[e+2]&&(n[e+2].trim()||l&&`
|
|
12
12
|
\r`.includes(n[e+2])||i&&n[e+2]===E))return e+2;for(let r=e+1,a=n.length;r<a;r++)if(n[r].trim()||l&&`
|
|
13
13
|
\r`.includes(n[r])||i&&n[r]===E)return r;return null}function S(n,e=0){return N({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function te(n,e){return N({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function le(n,e){return N({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function R({str:n,idx:e,stopAtNewlines:l,stopAtRawNbsp:i}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),e<1))return null;if(n[~-e]&&(n[~-e].trim()||l&&`
|
|
@@ -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.2
|
|
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.15",
|
|
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.2",
|
|
77
77
|
"rfdc": "^1.3.0"
|
|
78
78
|
}
|
|
79
79
|
}
|