string-left-right 6.0.3 → 6.0.5

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.3
4
+ * @version 6.0.5
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}from"codsen-utils";import $ from"lodash.clonedeep";var S="6.0.3";var C=S,c="\xA0";function I(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 R(n){return typeof n=="number"}function b(n){return typeof n=="string"}function D({str:n,idx:e=0,stopAtNewlines:l=!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()||l&&`
10
+ import{isPlainObject as p}from"codsen-utils";import $ from"lodash.clonedeep";var S="6.0.5";var C=S,c="\xA0";function I(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 R(n){return typeof n=="number"}function b(n){return typeof n=="string"}function D({str:n,idx:e=0,stopAtNewlines:l=!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()||l&&`
11
11
  \r`.includes(n[e+1])||u&&n[e+1]===c))return e+1;if(n[e+2]&&(n[e+2].trim()||l&&`
12
12
  \r`.includes(n[e+2])||u&&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])||u&&n[t]===c)return t;return null}function E(n,e=0){return D({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}function j(n,e){return D({str:n,idx:e,stopAtNewlines:!0,stopAtRawNbsp:!1})}function k(n,e){return D({str:n,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!0})}function V({str:n,idx:e,stopAtNewlines:l,stopAtRawNbsp:u}){if(typeof n!="string"||!n.length||((!e||typeof e!="number")&&(e=0),e<1))return null;if(n[~-e]&&(n[~-e].trim()||l&&`
@@ -1,23 +1,23 @@
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.3
4
+ * @version 6.0.5
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 ut=Object.create;var A=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols,ct=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var fe=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))ge.call(t,n)&&fe(e,n,t[n]);if(ce)for(var n of ce(t))ft.call(t,n)&&fe(e,n,t[n]);return e};var gt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ht=(e,t)=>{for(var n in t)A(e,n,{get:t[n],enumerable:!0})},he=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of at(t))!ge.call(e,o)&&o!==n&&A(e,o,{get:()=>t[o],enumerable:!(r=st(t,o))||r.enumerable});return e};var pt=(e,t,n)=>(n=e!=null?ut(ct(e)):{},he(t||!e||!e.__esModule?A(n,"default",{value:e,enumerable:!0}):n,e)),mt=e=>he(A({},"__esModule",{value:!0}),e);var tt=gt((C,O)=>{var bt=200,De="__lodash_hash_undefined__",Te=9007199254740991,ee="[object Arguments]",dt="[object Array]",ve="[object Boolean]",Ne="[object Date]",$t="[object Error]",te="[object Function]",Ve="[object GeneratorFunction]",U="[object Map]",Re="[object Number]",ne="[object Object]",pe="[object Promise]",Ae="[object RegExp]",F="[object Set]",Ce="[object String]",Ie="[object Symbol]",K="[object WeakMap]",je="[object ArrayBuffer]",J="[object DataView]",Le="[object Float32Array]",Ue="[object Float64Array]",Fe="[object Int8Array]",Je="[object Int16Array]",xe="[object Int32Array]",Me="[object Uint8Array]",Pe="[object Uint8ClampedArray]",qe="[object Uint16Array]",He="[object Uint32Array]",yt=/[\\^$.*+?()[\]{}|]/g,Et=/\w*$/,wt=/^\[object .+?Constructor\]$/,St=/^(?:0|[1-9]\d*)$/,s={};s[ee]=s[dt]=s[je]=s[J]=s[ve]=s[Ne]=s[Le]=s[Ue]=s[Fe]=s[Je]=s[xe]=s[U]=s[Re]=s[ne]=s[Ae]=s[F]=s[Ce]=s[Ie]=s[Me]=s[Pe]=s[qe]=s[He]=!0;s[$t]=s[te]=s[K]=!1;var _t=typeof global=="object"&&global&&global.Object===Object&&global,Ot=typeof self=="object"&&self&&self.Object===Object&&self,m=_t||Ot||Function("return this")(),ke=typeof C=="object"&&C&&!C.nodeType&&C,me=ke&&typeof O=="object"&&O&&!O.nodeType&&O,Dt=me&&me.exports===ke;function Tt(e,t){return e.set(t[0],t[1]),e}function vt(e,t){return e.add(t),e}function Nt(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}function Vt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function Be(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Rt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function At(e,t){return e==null?void 0:e[t]}function Ge(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function be(e){var t=-1,n=Array(e.size);return e.forEach(function(r,o){n[++t]=[o,r]}),n}function re(e,t){return function(n){return e(t(n))}}function de(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Ct=Array.prototype,It=Function.prototype,x=Object.prototype,W=m["__core-js_shared__"],$e=function(){var e=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),We=It.toString,$=x.hasOwnProperty,M=x.toString,jt=RegExp("^"+We.call($).replace(yt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ye=Dt?m.Buffer:void 0,Ee=m.Symbol,we=m.Uint8Array,Lt=re(Object.getPrototypeOf,Object),Ut=Object.create,Ft=x.propertyIsEnumerable,Jt=Ct.splice,Se=Object.getOwnPropertySymbols,xt=ye?ye.isBuffer:void 0,Mt=re(Object.keys,Object),Q=v(m,"DataView"),I=v(m,"Map"),Y=v(m,"Promise"),X=v(m,"Set"),Z=v(m,"WeakMap"),j=v(Object,"create"),Pt=S(Q),qt=S(I),Ht=S(Y),kt=S(X),Bt=S(Z),_e=Ee?Ee.prototype:void 0,Oe=_e?_e.valueOf:void 0;function w(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gt(){this.__data__=j?j(null):{}}function Wt(e){return this.has(e)&&delete this.__data__[e]}function Kt(e){var t=this.__data__;if(j){var n=t[e];return n===De?void 0:n}return $.call(t,e)?t[e]:void 0}function Qt(e){var t=this.__data__;return j?t[e]!==void 0:$.call(t,e)}function Yt(e,t){var n=this.__data__;return n[e]=j&&t===void 0?De:t,this}w.prototype.clear=Gt;w.prototype.delete=Wt;w.prototype.get=Kt;w.prototype.has=Qt;w.prototype.set=Yt;function b(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Xt(){this.__data__=[]}function Zt(e){var t=this.__data__,n=P(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Jt.call(t,n,1),!0}function zt(e){var t=this.__data__,n=P(t,e);return n<0?void 0:t[n][1]}function en(e){return P(this.__data__,e)>-1}function tn(e,t){var n=this.__data__,r=P(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}b.prototype.clear=Xt;b.prototype.delete=Zt;b.prototype.get=zt;b.prototype.has=en;b.prototype.set=tn;function D(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function nn(){this.__data__={hash:new w,map:new(I||b),string:new w}}function rn(e){return q(this,e).delete(e)}function on(e){return q(this,e).get(e)}function ln(e){return q(this,e).has(e)}function un(e,t){return q(this,e).set(e,t),this}D.prototype.clear=nn;D.prototype.delete=rn;D.prototype.get=on;D.prototype.has=ln;D.prototype.set=un;function T(e){this.__data__=new b(e)}function sn(){this.__data__=new b}function an(e){return this.__data__.delete(e)}function cn(e){return this.__data__.get(e)}function fn(e){return this.__data__.has(e)}function gn(e,t){var n=this.__data__;if(n instanceof b){var r=n.__data__;if(!I||r.length<bt-1)return r.push([e,t]),this;n=this.__data__=new D(r)}return n.set(e,t),this}T.prototype.clear=sn;T.prototype.delete=an;T.prototype.get=cn;T.prototype.has=fn;T.prototype.set=gn;function hn(e,t){var n=le(e)||Fn(e)?Rt(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||$.call(e,i))&&!(o&&(i=="length"||In(i,r)))&&n.push(i);return n}function Ke(e,t,n){var r=e[t];(!($.call(e,t)&&Ze(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function P(e,t){for(var n=e.length;n--;)if(Ze(e[n][0],t))return n;return-1}function pn(e,t){return e&&Qe(t,ie(t),e)}function z(e,t,n,r,o,i,l){var c;if(r&&(c=i?r(e,o,i,l):r(e)),c!==void 0)return c;if(!H(e))return e;var h=le(e);if(h){if(c=Rn(e),!t)return vn(e,c)}else{var u=E(e),a=u==te||u==Ve;if(xn(e))return En(e,t);if(u==ne||u==ee||a&&!i){if(Ge(e))return i?e:{};if(c=An(a?{}:e),!t)return Nn(e,pn(c,e))}else{if(!s[u])return i?e:{};c=Cn(e,u,z,t)}}l||(l=new T);var g=l.get(e);if(g)return g;if(l.set(e,c),!h)var _=n?Vn(e):ie(e);return Nt(_||e,function(R,f){_&&(f=R,R=e[f]),Ke(c,f,z(R,t,n,r,f,e,l))}),c}function mn(e){return H(e)?Ut(e):{}}function bn(e,t,n){var r=t(e);return le(e)?r:Vt(r,n(e))}function dn(e){return M.call(e)}function $n(e){if(!H(e)||Ln(e))return!1;var t=et(e)||Ge(e)?jt:wt;return t.test(S(e))}function yn(e){if(!Xe(e))return Mt(e);var t=[];for(var n in Object(e))$.call(e,n)&&n!="constructor"&&t.push(n);return t}function En(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function oe(e){var t=new e.constructor(e.byteLength);return new we(t).set(new we(e)),t}function wn(e,t){var n=t?oe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Sn(e,t,n){var r=t?n(be(e),!0):be(e);return Be(r,Tt,new e.constructor)}function _n(e){var t=new e.constructor(e.source,Et.exec(e));return t.lastIndex=e.lastIndex,t}function On(e,t,n){var r=t?n(de(e),!0):de(e);return Be(r,vt,new e.constructor)}function Dn(e){return Oe?Object(Oe.call(e)):{}}function Tn(e,t){var n=t?oe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function vn(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function Qe(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var l=t[o],c=r?r(n[l],e[l],l,n,e):void 0;Ke(n,l,c===void 0?e[l]:c)}return n}function Nn(e,t){return Qe(e,Ye(e),t)}function Vn(e){return bn(e,ie,Ye)}function q(e,t){var n=e.__data__;return jn(t)?n[typeof t=="string"?"string":"hash"]:n.map}function v(e,t){var n=At(e,t);return $n(n)?n:void 0}var Ye=Se?re(Se,Object):qn,E=dn;(Q&&E(new Q(new ArrayBuffer(1)))!=J||I&&E(new I)!=U||Y&&E(Y.resolve())!=pe||X&&E(new X)!=F||Z&&E(new Z)!=K)&&(E=function(e){var t=M.call(e),n=t==ne?e.constructor:void 0,r=n?S(n):void 0;if(r)switch(r){case Pt:return J;case qt:return U;case Ht:return pe;case kt:return F;case Bt:return K}return t});function Rn(e){var t=e.length,n=e.constructor(t);return t&&typeof e[0]=="string"&&$.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function An(e){return typeof e.constructor=="function"&&!Xe(e)?mn(Lt(e)):{}}function Cn(e,t,n,r){var o=e.constructor;switch(t){case je:return oe(e);case ve:case Ne:return new o(+e);case J:return wn(e,r);case Le:case Ue:case Fe:case Je:case xe:case Me:case Pe:case qe:case He:return Tn(e,r);case U:return Sn(e,r,n);case Re:case Ce:return new o(e);case Ae:return _n(e);case F:return On(e,r,n);case Ie:return Dn(e)}}function In(e,t){return t=t==null?Te:t,!!t&&(typeof e=="number"||St.test(e))&&e>-1&&e%1==0&&e<t}function jn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ln(e){return!!$e&&$e in e}function Xe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||x;return e===n}function S(e){if(e!=null){try{return We.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Un(e){return z(e,!0,!0)}function Ze(e,t){return e===t||e!==e&&t!==t}function Fn(e){return Jn(e)&&$.call(e,"callee")&&(!Ft.call(e,"callee")||M.call(e)==ee)}var le=Array.isArray;function ze(e){return e!=null&&Mn(e.length)&&!et(e)}function Jn(e){return Pn(e)&&ze(e)}var xn=xt||Hn;function et(e){var t=H(e)?M.call(e):"";return t==te||t==Ve}function Mn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Te}function H(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Pn(e){return!!e&&typeof e=="object"}function ie(e){return ze(e)?hn(e):yn(e)}function qn(){return[]}function Hn(){return!1}O.exports=Un});var zn={};ht(zn,{chompLeft:()=>Xn,chompRight:()=>Zn,left:()=>B,leftSeq:()=>lt,leftStopAtNewLines:()=>Qn,leftStopAtRawNbsp:()=>Yn,right:()=>k,rightSeq:()=>it,rightStopAtNewLines:()=>Wn,rightStopAtRawNbsp:()=>Kn,version:()=>Bn});function y(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}var d=pt(tt(),1);var nt="6.0.3";var Bn=nt,N="\xA0";function Gn(e){let t={value:e,hungry:!1,optional:!1};return(t.value.endsWith("?*")||t.value.endsWith("*?"))&&t.value.length>2?(t.value=t.value.slice(0,t.value.length-2),t.optional=!0,t.hungry=!0):t.value.endsWith("?")&&t.value.length>1?(t.value=t.value.slice(0,~-t.value.length),t.optional=!0):t.value.endsWith("*")&&t.value.length>1&&(t.value=t.value.slice(0,~-t.value.length),t.hungry=!0),t}function rt(e){return typeof e=="number"}function L(e){return typeof e=="string"}function ue({str:e,idx:t=0,stopAtNewlines:n=!1,stopAtRawNbsp:r=!1}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),!e[t+1]))return null;if(e[t+1]&&(e[t+1].trim()||n&&`
10
+ "use strict";var stringLeftRight=(()=>{var ut=Object.create;var A=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols,ct=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var fe=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))ge.call(t,n)&&fe(e,n,t[n]);if(ce)for(var n of ce(t))ft.call(t,n)&&fe(e,n,t[n]);return e};var gt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ht=(e,t)=>{for(var n in t)A(e,n,{get:t[n],enumerable:!0})},he=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of at(t))!ge.call(e,o)&&o!==n&&A(e,o,{get:()=>t[o],enumerable:!(r=st(t,o))||r.enumerable});return e};var pt=(e,t,n)=>(n=e!=null?ut(ct(e)):{},he(t||!e||!e.__esModule?A(n,"default",{value:e,enumerable:!0}):n,e)),mt=e=>he(A({},"__esModule",{value:!0}),e);var tt=gt((C,O)=>{var bt=200,De="__lodash_hash_undefined__",Te=9007199254740991,ee="[object Arguments]",dt="[object Array]",ve="[object Boolean]",Ne="[object Date]",$t="[object Error]",te="[object Function]",Ve="[object GeneratorFunction]",U="[object Map]",Re="[object Number]",ne="[object Object]",pe="[object Promise]",Ae="[object RegExp]",F="[object Set]",Ce="[object String]",Ie="[object Symbol]",K="[object WeakMap]",je="[object ArrayBuffer]",x="[object DataView]",Le="[object Float32Array]",Ue="[object Float64Array]",Fe="[object Int8Array]",xe="[object Int16Array]",Je="[object Int32Array]",Me="[object Uint8Array]",Pe="[object Uint8ClampedArray]",qe="[object Uint16Array]",He="[object Uint32Array]",yt=/[\\^$.*+?()[\]{}|]/g,Et=/\w*$/,St=/^\[object .+?Constructor\]$/,wt=/^(?:0|[1-9]\d*)$/,s={};s[ee]=s[dt]=s[je]=s[x]=s[ve]=s[Ne]=s[Le]=s[Ue]=s[Fe]=s[xe]=s[Je]=s[U]=s[Re]=s[ne]=s[Ae]=s[F]=s[Ce]=s[Ie]=s[Me]=s[Pe]=s[qe]=s[He]=!0;s[$t]=s[te]=s[K]=!1;var _t=typeof global=="object"&&global&&global.Object===Object&&global,Ot=typeof self=="object"&&self&&self.Object===Object&&self,m=_t||Ot||Function("return this")(),We=typeof C=="object"&&C&&!C.nodeType&&C,me=We&&typeof O=="object"&&O&&!O.nodeType&&O,Dt=me&&me.exports===We;function Tt(e,t){return e.set(t[0],t[1]),e}function vt(e,t){return e.add(t),e}function Nt(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}function Vt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function ke(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Rt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function At(e,t){return e==null?void 0:e[t]}function Be(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function be(e){var t=-1,n=Array(e.size);return e.forEach(function(r,o){n[++t]=[o,r]}),n}function re(e,t){return function(n){return e(t(n))}}function de(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Ct=Array.prototype,It=Function.prototype,J=Object.prototype,G=m["__core-js_shared__"],$e=function(){var e=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ge=It.toString,$=J.hasOwnProperty,M=J.toString,jt=RegExp("^"+Ge.call($).replace(yt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ye=Dt?m.Buffer:void 0,Ee=m.Symbol,Se=m.Uint8Array,Lt=re(Object.getPrototypeOf,Object),Ut=Object.create,Ft=J.propertyIsEnumerable,xt=Ct.splice,we=Object.getOwnPropertySymbols,Jt=ye?ye.isBuffer:void 0,Mt=re(Object.keys,Object),Q=v(m,"DataView"),I=v(m,"Map"),Y=v(m,"Promise"),X=v(m,"Set"),Z=v(m,"WeakMap"),j=v(Object,"create"),Pt=w(Q),qt=w(I),Ht=w(Y),Wt=w(X),kt=w(Z),_e=Ee?Ee.prototype:void 0,Oe=_e?_e.valueOf:void 0;function S(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Bt(){this.__data__=j?j(null):{}}function Gt(e){return this.has(e)&&delete this.__data__[e]}function Kt(e){var t=this.__data__;if(j){var n=t[e];return n===De?void 0:n}return $.call(t,e)?t[e]:void 0}function Qt(e){var t=this.__data__;return j?t[e]!==void 0:$.call(t,e)}function Yt(e,t){var n=this.__data__;return n[e]=j&&t===void 0?De:t,this}S.prototype.clear=Bt;S.prototype.delete=Gt;S.prototype.get=Kt;S.prototype.has=Qt;S.prototype.set=Yt;function b(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Xt(){this.__data__=[]}function Zt(e){var t=this.__data__,n=P(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():xt.call(t,n,1),!0}function zt(e){var t=this.__data__,n=P(t,e);return n<0?void 0:t[n][1]}function en(e){return P(this.__data__,e)>-1}function tn(e,t){var n=this.__data__,r=P(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}b.prototype.clear=Xt;b.prototype.delete=Zt;b.prototype.get=zt;b.prototype.has=en;b.prototype.set=tn;function D(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function nn(){this.__data__={hash:new S,map:new(I||b),string:new S}}function rn(e){return q(this,e).delete(e)}function on(e){return q(this,e).get(e)}function ln(e){return q(this,e).has(e)}function un(e,t){return q(this,e).set(e,t),this}D.prototype.clear=nn;D.prototype.delete=rn;D.prototype.get=on;D.prototype.has=ln;D.prototype.set=un;function T(e){this.__data__=new b(e)}function sn(){this.__data__=new b}function an(e){return this.__data__.delete(e)}function cn(e){return this.__data__.get(e)}function fn(e){return this.__data__.has(e)}function gn(e,t){var n=this.__data__;if(n instanceof b){var r=n.__data__;if(!I||r.length<bt-1)return r.push([e,t]),this;n=this.__data__=new D(r)}return n.set(e,t),this}T.prototype.clear=sn;T.prototype.delete=an;T.prototype.get=cn;T.prototype.has=fn;T.prototype.set=gn;function hn(e,t){var n=le(e)||Fn(e)?Rt(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||$.call(e,i))&&!(o&&(i=="length"||In(i,r)))&&n.push(i);return n}function Ke(e,t,n){var r=e[t];(!($.call(e,t)&&Ze(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function P(e,t){for(var n=e.length;n--;)if(Ze(e[n][0],t))return n;return-1}function pn(e,t){return e&&Qe(t,ie(t),e)}function z(e,t,n,r,o,i,l){var c;if(r&&(c=i?r(e,o,i,l):r(e)),c!==void 0)return c;if(!H(e))return e;var h=le(e);if(h){if(c=Rn(e),!t)return vn(e,c)}else{var u=E(e),a=u==te||u==Ve;if(Jn(e))return En(e,t);if(u==ne||u==ee||a&&!i){if(Be(e))return i?e:{};if(c=An(a?{}:e),!t)return Nn(e,pn(c,e))}else{if(!s[u])return i?e:{};c=Cn(e,u,z,t)}}l||(l=new T);var g=l.get(e);if(g)return g;if(l.set(e,c),!h)var _=n?Vn(e):ie(e);return Nt(_||e,function(R,f){_&&(f=R,R=e[f]),Ke(c,f,z(R,t,n,r,f,e,l))}),c}function mn(e){return H(e)?Ut(e):{}}function bn(e,t,n){var r=t(e);return le(e)?r:Vt(r,n(e))}function dn(e){return M.call(e)}function $n(e){if(!H(e)||Ln(e))return!1;var t=et(e)||Be(e)?jt:St;return t.test(w(e))}function yn(e){if(!Xe(e))return Mt(e);var t=[];for(var n in Object(e))$.call(e,n)&&n!="constructor"&&t.push(n);return t}function En(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function oe(e){var t=new e.constructor(e.byteLength);return new Se(t).set(new Se(e)),t}function Sn(e,t){var n=t?oe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function wn(e,t,n){var r=t?n(be(e),!0):be(e);return ke(r,Tt,new e.constructor)}function _n(e){var t=new e.constructor(e.source,Et.exec(e));return t.lastIndex=e.lastIndex,t}function On(e,t,n){var r=t?n(de(e),!0):de(e);return ke(r,vt,new e.constructor)}function Dn(e){return Oe?Object(Oe.call(e)):{}}function Tn(e,t){var n=t?oe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function vn(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function Qe(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var l=t[o],c=r?r(n[l],e[l],l,n,e):void 0;Ke(n,l,c===void 0?e[l]:c)}return n}function Nn(e,t){return Qe(e,Ye(e),t)}function Vn(e){return bn(e,ie,Ye)}function q(e,t){var n=e.__data__;return jn(t)?n[typeof t=="string"?"string":"hash"]:n.map}function v(e,t){var n=At(e,t);return $n(n)?n:void 0}var Ye=we?re(we,Object):qn,E=dn;(Q&&E(new Q(new ArrayBuffer(1)))!=x||I&&E(new I)!=U||Y&&E(Y.resolve())!=pe||X&&E(new X)!=F||Z&&E(new Z)!=K)&&(E=function(e){var t=M.call(e),n=t==ne?e.constructor:void 0,r=n?w(n):void 0;if(r)switch(r){case Pt:return x;case qt:return U;case Ht:return pe;case Wt:return F;case kt:return K}return t});function Rn(e){var t=e.length,n=e.constructor(t);return t&&typeof e[0]=="string"&&$.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function An(e){return typeof e.constructor=="function"&&!Xe(e)?mn(Lt(e)):{}}function Cn(e,t,n,r){var o=e.constructor;switch(t){case je:return oe(e);case ve:case Ne:return new o(+e);case x:return Sn(e,r);case Le:case Ue:case Fe:case xe:case Je:case Me:case Pe:case qe:case He:return Tn(e,r);case U:return wn(e,r,n);case Re:case Ce:return new o(e);case Ae:return _n(e);case F:return On(e,r,n);case Ie:return Dn(e)}}function In(e,t){return t=t==null?Te:t,!!t&&(typeof e=="number"||wt.test(e))&&e>-1&&e%1==0&&e<t}function jn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ln(e){return!!$e&&$e in e}function Xe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||J;return e===n}function w(e){if(e!=null){try{return Ge.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Un(e){return z(e,!0,!0)}function Ze(e,t){return e===t||e!==e&&t!==t}function Fn(e){return xn(e)&&$.call(e,"callee")&&(!Ft.call(e,"callee")||M.call(e)==ee)}var le=Array.isArray;function ze(e){return e!=null&&Mn(e.length)&&!et(e)}function xn(e){return Pn(e)&&ze(e)}var Jn=Jt||Hn;function et(e){var t=H(e)?M.call(e):"";return t==te||t==Ve}function Mn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Te}function H(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Pn(e){return!!e&&typeof e=="object"}function ie(e){return ze(e)?hn(e):yn(e)}function qn(){return[]}function Hn(){return!1}O.exports=Un});var zn={};ht(zn,{chompLeft:()=>Xn,chompRight:()=>Zn,left:()=>k,leftSeq:()=>lt,leftStopAtNewLines:()=>Qn,leftStopAtRawNbsp:()=>Yn,right:()=>W,rightSeq:()=>it,rightStopAtNewLines:()=>Gn,rightStopAtRawNbsp:()=>Kn,version:()=>kn});function y(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}var d=pt(tt(),1);var nt="6.0.5";var kn=nt,N="\xA0";function Bn(e){let t={value:e,hungry:!1,optional:!1};return(t.value.endsWith("?*")||t.value.endsWith("*?"))&&t.value.length>2?(t.value=t.value.slice(0,t.value.length-2),t.optional=!0,t.hungry=!0):t.value.endsWith("?")&&t.value.length>1?(t.value=t.value.slice(0,~-t.value.length),t.optional=!0):t.value.endsWith("*")&&t.value.length>1&&(t.value=t.value.slice(0,~-t.value.length),t.hungry=!0),t}function rt(e){return typeof e=="number"}function L(e){return typeof e=="string"}function ue({str:e,idx:t=0,stopAtNewlines:n=!1,stopAtRawNbsp:r=!1}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),!e[t+1]))return null;if(e[t+1]&&(e[t+1].trim()||n&&`
11
11
  \r`.includes(e[t+1])||r&&e[t+1]===N))return t+1;if(e[t+2]&&(e[t+2].trim()||n&&`
12
12
  \r`.includes(e[t+2])||r&&e[t+2]===N))return t+2;for(let o=t+1,i=e.length;o<i;o++)if(e[o].trim()||n&&`
13
- \r`.includes(e[o])||r&&e[o]===N)return o;return null}function k(e,t=0){return ue({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Wn(e,t){return ue({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}function Kn(e,t){return ue({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}function se({str:e,idx:t,stopAtNewlines:n,stopAtRawNbsp:r}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||n&&`
13
+ \r`.includes(e[o])||r&&e[o]===N)return o;return null}function W(e,t=0){return ue({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Gn(e,t){return ue({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}function Kn(e,t){return ue({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}function se({str:e,idx:t,stopAtNewlines:n,stopAtRawNbsp:r}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||n&&`
14
14
  \r`.includes(e[~-t])||r&&e[~-t]===N))return~-t;if(e[t-2]&&(e[t-2].trim()||n&&`
15
15
  \r`.includes(e[t-2])||r&&e[t-2]===N))return t-2;for(let o=t;o--;)if(e[o]&&(e[o].trim()||n&&`
16
- \r`.includes(e[o])||r&&e[o]===N))return o;return null}function B(e,t=0){return se({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Qn(e,t){return se({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}function Yn(e,t){return se({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}function ot(e,t,n,r,o){if(typeof t!="string"||!t.length||(typeof n!="number"&&(n=0),e==="right"&&!t[n+1]||e==="left"&&!t[~-n]))return null;let i=n,l=[],c,h,u,a=0;for(;a<o.length;){if(!L(o[a])||!o[a].length){a+=1;continue}let{value:g,optional:_,hungry:R}=Gn(o[a]),f=e==="right"?k(t,i):B(t,i);if(r.i&&t[f].toLowerCase()===g.toLowerCase()||!r.i&&t[f]===g){let ae=e==="right"?k(t,f):B(t,f);R&&(r.i&&t[ae].toLowerCase()===g.toLowerCase()||!r.i&&t[ae]===g)?u=!0:a+=1,typeof f=="number"&&e==="right"&&f>i+1?l.push([i+1,f]):e==="left"&&typeof f=="number"&&f<~-i&&l.unshift([f+1,i]),i=f,e==="right"?(c===void 0&&(c=f),h=f):(h===void 0&&(h=f),c=f)}else if(_){a+=1;continue}else if(u){a+=1,u=void 0;continue}else return null}return c===void 0||h===void 0?null:{gaps:l,leftmostChar:c,rightmostChar:h}}var G={i:!1};function lt(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let r;return y(n[0])?r=p(p({},G),n.shift()):r=G,ot("left",e,t,r,Array.from(n).reverse())}function it(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let r;return y(n[0])?r=p(p({},G),n.shift()):r=G,ot("right",e,t,r,n)}function V(e,t,n,r,o=[]){var h;if(typeof t!="string"||!t.length||((!n||typeof n!="number")&&(n=0),e==="right"&&!t[n+1]||e==="left"&&+n==0))return null;let i=null,l=null;do i=e==="right"?it(t,typeof l=="number"?l:n,...o):lt(t,typeof l=="number"?l:n,...o),i!==null&&(l=e==="right"?i.rightmostChar:i.leftmostChar);while(i);if(l!=null&&e==="right"&&(l+=1),l===null)return null;if(e==="right"){if((h=t[l])!=null&&h.trim())return l;let u=k(t,l);if(!r||r.mode===0){if(u===l+1)return l;if(t.slice(l,u||t.length).trim()||t.slice(l,u||t.length).includes(`
16
+ \r`.includes(e[o])||r&&e[o]===N))return o;return null}function k(e,t=0){return se({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Qn(e,t){return se({str:e,idx:t,stopAtNewlines:!0,stopAtRawNbsp:!1})}function Yn(e,t){return se({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!0})}function ot(e,t,n,r,o){if(typeof t!="string"||!t.length||(typeof n!="number"&&(n=0),e==="right"&&!t[n+1]||e==="left"&&!t[~-n]))return null;let i=n,l=[],c,h,u,a=0;for(;a<o.length;){if(!L(o[a])||!o[a].length){a+=1;continue}let{value:g,optional:_,hungry:R}=Bn(o[a]),f=e==="right"?W(t,i):k(t,i);if(r.i&&t[f].toLowerCase()===g.toLowerCase()||!r.i&&t[f]===g){let ae=e==="right"?W(t,f):k(t,f);R&&(r.i&&t[ae].toLowerCase()===g.toLowerCase()||!r.i&&t[ae]===g)?u=!0:a+=1,typeof f=="number"&&e==="right"&&f>i+1?l.push([i+1,f]):e==="left"&&typeof f=="number"&&f<~-i&&l.unshift([f+1,i]),i=f,e==="right"?(c===void 0&&(c=f),h=f):(h===void 0&&(h=f),c=f)}else if(_){a+=1;continue}else if(u){a+=1,u=void 0;continue}else return null}return c===void 0||h===void 0?null:{gaps:l,leftmostChar:c,rightmostChar:h}}var B={i:!1};function lt(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let r;return y(n[0])?r=p(p({},B),n.shift()):r=B,ot("left",e,t,r,Array.from(n).reverse())}function it(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let r;return y(n[0])?r=p(p({},B),n.shift()):r=B,ot("right",e,t,r,n)}function V(e,t,n,r,o=[]){var h;if(typeof t!="string"||!t.length||((!n||typeof n!="number")&&(n=0),e==="right"&&!t[n+1]||e==="left"&&+n==0))return null;let i=null,l=null;do i=e==="right"?it(t,typeof l=="number"?l:n,...o):lt(t,typeof l=="number"?l:n,...o),i!==null&&(l=e==="right"?i.rightmostChar:i.leftmostChar);while(i);if(l!=null&&e==="right"&&(l+=1),l===null)return null;if(e==="right"){if((h=t[l])!=null&&h.trim())return l;let u=W(t,l);if(!r||r.mode===0){if(u===l+1)return l;if(t.slice(l,u||t.length).trim()||t.slice(l,u||t.length).includes(`
17
17
  `)||t.slice(l,u||t.length).includes("\r")){for(let a=l,g=t.length;a<g;a++)if(`
18
18
  \r`.includes(t[a]))return a}else return u?~-u:t.length}else{if(r.mode===1)return l;if(r.mode===2){let a=t.slice(l);if(a.trim()||a.includes(`
19
19
  `)||a.includes("\r")){for(let g=l,_=t.length;g<_;g++)if(t[g].trim()||`
20
- \r`.includes(t[g]))return g}return t.length}}return u||t.length}if(t[l]&&t[~-l]&&t[~-l].trim())return l;let c=B(t,l);if(!r||r.mode===0){if(c===l-2)return l;if(t.slice(0,l).trim()||t.slice(0,l).includes(`
20
+ \r`.includes(t[g]))return g}return t.length}}return u||t.length}if(t[l]&&t[~-l]&&t[~-l].trim())return l;let c=k(t,l);if(!r||r.mode===0){if(c===l-2)return l;if(t.slice(0,l).trim()||t.slice(0,l).includes(`
21
21
  `)||t.slice(0,l).includes("\r")){for(let u=l;u--;)if(`
22
22
  \r`.includes(t[u])||t[u].trim())return u+1+(t[u].trim()?1:0)}return 0}if(r.mode===1)return l;if(r.mode===2){let u=t.slice(0,l);if(u.trim()||u.includes(`
23
23
  `)||u.includes("\r")){for(let a=l;a--;)if(t[a].trim()||`
@@ -25,7 +25,7 @@
25
25
  /**
26
26
  * @name codsen-utils
27
27
  * @fileoverview Various utility functions
28
- * @version 1.0.1
28
+ * @version 1.1.1
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",
3
+ "version": "6.0.5",
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.0.1",
76
+ "codsen-utils": "^1.1.1",
77
77
  "lodash.clonedeep": "^4.5.0"
78
78
  },
79
79
  "devDependencies": {