string-match-left-right 9.0.32 → 9.0.34

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/.eslintcache ADDED
@@ -0,0 +1 @@
1
+ [{"/home/runner/work/codsen/codsen/packages/string-match-left-right/examples/_quickTake.js":"1","/home/runner/work/codsen/codsen/packages/string-match-left-right/examples/cb.js":"2","/home/runner/work/codsen/codsen/packages/string-match-left-right/perf/check.js":"3","/home/runner/work/codsen/codsen/packages/string-match-left-right/rollup.config.js":"4","/home/runner/work/codsen/codsen/packages/string-match-left-right/src/main.ts":"5","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/adhoc.js":"6","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/api.js":"7","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/cb.js":"8","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/eol.js":"9","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/matchLeft.js":"10","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/matchLeftIncl.js":"11","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/matchRight.js":"12","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/matchRightIncl.js":"13","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/trim-combos.js":"14","/home/runner/work/codsen/codsen/packages/string-match-left-right/test/trimCharsBeforeMatching.js":"15"},{"size":883,"mtime":1760280945969,"results":"16","hashOfConfig":"17"},{"size":783,"mtime":1760280945969,"results":"18","hashOfConfig":"17"},{"size":320,"mtime":1760280945969,"results":"19","hashOfConfig":"20"},{"size":373,"mtime":1760280945969,"results":"21","hashOfConfig":"17"},{"size":36947,"mtime":1760280945969,"results":"22","hashOfConfig":"20"},{"size":11364,"mtime":1760280945969,"results":"23","hashOfConfig":"24"},{"size":2403,"mtime":1760280945969,"results":"25","hashOfConfig":"24"},{"size":28071,"mtime":1760280945969,"results":"26","hashOfConfig":"24"},{"size":23679,"mtime":1760280945969,"results":"27","hashOfConfig":"24"},{"size":9905,"mtime":1760280945969,"results":"28","hashOfConfig":"24"},{"size":8058,"mtime":1760280945969,"results":"29","hashOfConfig":"24"},{"size":14301,"mtime":1760280945969,"results":"30","hashOfConfig":"24"},{"size":6467,"mtime":1760280945970,"results":"31","hashOfConfig":"24"},{"size":2135,"mtime":1760280945970,"results":"32","hashOfConfig":"24"},{"size":8453,"mtime":1760280945970,"results":"33","hashOfConfig":"24"},{"filePath":"34","messages":"35","suppressedMessages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1f1u168",{"filePath":"37","messages":"38","suppressedMessages":"39","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","suppressedMessages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"91l1rm",{"filePath":"43","messages":"44","suppressedMessages":"45","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"46","messages":"47","suppressedMessages":"48","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"49","messages":"50","suppressedMessages":"51","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ns3qdb",{"filePath":"52","messages":"53","suppressedMessages":"54","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"55","messages":"56","suppressedMessages":"57","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"58","messages":"59","suppressedMessages":"60","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"61","messages":"62","suppressedMessages":"63","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"64","messages":"65","suppressedMessages":"66","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"67","messages":"68","suppressedMessages":"69","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"70","messages":"71","suppressedMessages":"72","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"73","messages":"74","suppressedMessages":"75","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"76","messages":"77","suppressedMessages":"78","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/runner/work/codsen/codsen/packages/string-match-left-right/examples/_quickTake.js",[],[],"/home/runner/work/codsen/codsen/packages/string-match-left-right/examples/cb.js",[],[],"/home/runner/work/codsen/codsen/packages/string-match-left-right/perf/check.js",[],[],"/home/runner/work/codsen/codsen/packages/string-match-left-right/rollup.config.js",[],[],"/home/runner/work/codsen/codsen/packages/string-match-left-right/src/main.ts",[],[],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/adhoc.js",[],["79","80","81","82","83","84"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/api.js",[],["85","86","87","88","89","90"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/cb.js",[],["91","92","93"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/eol.js",[],["94","95","96","97","98","99"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/matchLeft.js",[],["100","101","102","103","104","105"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/matchLeftIncl.js",[],["106","107","108","109","110","111"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/matchRight.js",[],["112","113","114","115","116","117"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/matchRightIncl.js",[],["118","119","120","121","122","123"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/trim-combos.js",[],["124","125","126","127","128","129"],"/home/runner/work/codsen/codsen/packages/string-match-left-right/test/trimCharsBeforeMatching.js",[],["130","131","132","133","134"],{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"138"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"140"},{"ruleId":"135","severity":2,"message":"141","line":3,"column":25,"nodeType":null,"messageId":"137","endLine":3,"endColumn":31,"suppressions":"142"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"144"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"146"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"148"},{"ruleId":"135","severity":2,"message":"149","line":3,"column":10,"nodeType":null,"messageId":"137","endLine":3,"endColumn":15,"suppressions":"150"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"151"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"152"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"153"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"154"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"155"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"156"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"157"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"158"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"159"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"160"},{"ruleId":"135","severity":2,"message":"141","line":3,"column":25,"nodeType":null,"messageId":"137","endLine":3,"endColumn":31,"suppressions":"161"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"162"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"163"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"164"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"165"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"166"},{"ruleId":"135","severity":2,"message":"141","line":3,"column":25,"nodeType":null,"messageId":"137","endLine":3,"endColumn":31,"suppressions":"167"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"168"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"169"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"170"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"171"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"172"},{"ruleId":"135","severity":2,"message":"141","line":3,"column":25,"nodeType":null,"messageId":"137","endLine":3,"endColumn":31,"suppressions":"173"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"174"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"175"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"176"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"177"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"178"},{"ruleId":"135","severity":2,"message":"141","line":3,"column":25,"nodeType":null,"messageId":"137","endLine":3,"endColumn":31,"suppressions":"179"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"180"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"181"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"182"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"183"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"184"},{"ruleId":"135","severity":2,"message":"141","line":3,"column":25,"nodeType":null,"messageId":"137","endLine":3,"endColumn":31,"suppressions":"185"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"186"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"187"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"188"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"189"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"190"},{"ruleId":"135","severity":2,"message":"141","line":3,"column":25,"nodeType":null,"messageId":"137","endLine":3,"endColumn":31,"suppressions":"191"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"192"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"193"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"194"},{"ruleId":"135","severity":2,"message":"136","line":3,"column":17,"nodeType":null,"messageId":"137","endLine":3,"endColumn":19,"suppressions":"195"},{"ruleId":"135","severity":2,"message":"139","line":3,"column":21,"nodeType":null,"messageId":"137","endLine":3,"endColumn":23,"suppressions":"196"},{"ruleId":"135","severity":2,"message":"143","line":3,"column":33,"nodeType":null,"messageId":"137","endLine":3,"endColumn":37,"suppressions":"197"},{"ruleId":"135","severity":2,"message":"145","line":3,"column":39,"nodeType":null,"messageId":"137","endLine":3,"endColumn":42,"suppressions":"198"},{"ruleId":"135","severity":2,"message":"147","line":3,"column":44,"nodeType":null,"messageId":"137","endLine":3,"endColumn":49,"suppressions":"199"},"@typescript-eslint/no-unused-vars","'is' is defined but never used.","unusedVar",["200"],"'ok' is defined but never used.",["201"],"'throws' is defined but never used.",["202"],"'type' is defined but never used.",["203"],"'not' is defined but never used.",["204"],"'match' is defined but never used.",["205"],"'equal' is defined but never used.",["206"],["207"],["208"],["209"],["210"],["211"],["212"],["213"],["214"],["215"],["216"],["217"],["218"],["219"],["220"],["221"],["222"],["223"],["224"],["225"],["226"],["227"],["228"],["229"],["230"],["231"],["232"],["233"],["234"],["235"],["236"],["237"],["238"],["239"],["240"],["241"],["242"],["243"],["244"],["245"],["246"],["247"],["248"],["249"],["250"],["251"],["252"],["253"],["254"],["255"],{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},{"kind":"256","justification":"257"},"directive",""]
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2025 Roy Revelt and other contributors
3
+ Copyright © 2010-2025 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -67,8 +67,8 @@ To report bugs or request features or assistance, [raise an issue](https://githu
67
67
 
68
68
  ## Licence
69
69
 
70
- MIT License.
70
+ MIT License
71
71
 
72
- Copyright © 2010-2025 Roy Revelt and other contributors.
72
+ Copyright © 2010-2025 Roy Revelt and other contributors
73
73
 
74
74
  <p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name string-match-left-right
3
3
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
4
- * @version 9.0.32
5
- * @author Roy Revelt, Codsen Ltd
4
+ * @version 9.0.34
5
+ * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-match-left-right/}
8
8
  */
9
9
 
10
- import{arrayiffy as N}from"arrayiffy-if-string";import{isPlainObject as R,isStr as d,hasOwnProp as k}from"codsen-utils";var O="9.0.32";var F=O,w={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},L=t=>t+1;function A(t,s,n,a,u=!1,o=L){let l=typeof n=="function"?n():n;if(+s<0&&u&&l==="EOL")return l;let r={...w,...a};if(s>=t.length&&!u)return!1;let c=u?1:n.length,E=0,h=!1,i=!1,m=!1,b=r.maxMismatches,e=s,$=!1,f=!1,g=!1;function D(){return E===1&&b<r.maxMismatches-1}for(;t[e];){let T=o(e);if(r.trimBeforeMatching&&t[e].trim()===""){if(!t[T]&&u&&n==="EOL")return!0;e=o(e);continue}if(r&&!r.i&&r?.trimCharsBeforeMatching?.includes(t[e])||r?.i&&r.trimCharsBeforeMatching&&r.trimCharsBeforeMatching.map(p=>p.toLowerCase()).includes(t[e].toLowerCase())){if(u&&n==="EOL"&&!t[T])return!0;e=o(e);continue}let y=T>e?n[n.length-c]:n[c-1];if(!r.i&&t[e]===y||r.i&&t[e].toLowerCase()===y.toLowerCase()){if($||($=!0),m||(m=!0),c===n.length){if(f=!0,b!==r.maxMismatches)return!1}else c===1&&(g=!0);if(c-=1,E++,D())return!1;if(!c)return E!==n.length||b===r.maxMismatches||!h?e:!1}else if(!h&&!E&&(h=!0),r.maxMismatches&&b&&e){b-=1;for(let p=0;p<=b;p++){let C=T>e?n[n.length-c+1+p]:n[c-2-p],M=t[o(e)];if(C&&(!r.i&&t[e]===C||r.i&&t[e].toLowerCase()===C.toLowerCase())&&(!r.firstMustMatch||c!==n.length)){if(E++,D())return!1;c-=2,$=!0;break}else if(M&&C&&(!r.i&&M===C||r.i&&M.toLowerCase()===C.toLowerCase())&&(!r.firstMustMatch||c!==n.length)){if(!E&&!r.hungry)return!1;c-=1,$=!0;break}else if(C===void 0&&b>=0&&$&&(!r.firstMustMatch||f)&&(!r.lastMustMatch||g))return e}$||(i=e)}else return e===0&&c===1&&!r.lastMustMatch&&m?0:!1;if(i!==!1&&i!==e&&(i=!1),c<1)return e;e=o(e)}if(c>0)return u&&l==="EOL"?!0:r&&r.maxMismatches>=c&&m?i||0:!1}function V(t,s,n,a,u){if(R(u)&&k(u,"trimBeforeMatching")&&u&&typeof u.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${t}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(u.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let o={...w,...u};if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=N(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map(h=>d(h)?h:String(h)),!d(s)||!s.length)return!1;if(!Number.isInteger(n)||n<0)throw new Error(`string-match-left-right/${t}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof n}, equal to:
10
+ import{arrayiffy as N}from"arrayiffy-if-string";import{isPlainObject as R,isStr as d,hasOwnProp as k}from"codsen-utils";var O="9.0.34";var F=O,w={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},L=t=>t+1;function A(t,s,n,a,u=!1,o=L){let l=typeof n=="function"?n():n;if(+s<0&&u&&l==="EOL")return l;let r={...w,...a};if(s>=t.length&&!u)return!1;let c=u?1:n.length,E=0,h=!1,i=!1,m=!1,b=r.maxMismatches,e=s,$=!1,f=!1,g=!1;function D(){return E===1&&b<r.maxMismatches-1}for(;t[e];){let T=o(e);if(r.trimBeforeMatching&&t[e].trim()===""){if(!t[T]&&u&&n==="EOL")return!0;e=o(e);continue}if(r&&!r.i&&r?.trimCharsBeforeMatching?.includes(t[e])||r?.i&&r.trimCharsBeforeMatching&&r.trimCharsBeforeMatching.map(p=>p.toLowerCase()).includes(t[e].toLowerCase())){if(u&&n==="EOL"&&!t[T])return!0;e=o(e);continue}let y=T>e?n[n.length-c]:n[c-1];if(!r.i&&t[e]===y||r.i&&t[e].toLowerCase()===y.toLowerCase()){if($||($=!0),m||(m=!0),c===n.length){if(f=!0,b!==r.maxMismatches)return!1}else c===1&&(g=!0);if(c-=1,E++,D())return!1;if(!c)return E!==n.length||b===r.maxMismatches||!h?e:!1}else if(!h&&!E&&(h=!0),r.maxMismatches&&b&&e){b-=1;for(let p=0;p<=b;p++){let C=T>e?n[n.length-c+1+p]:n[c-2-p],M=t[o(e)];if(C&&(!r.i&&t[e]===C||r.i&&t[e].toLowerCase()===C.toLowerCase())&&(!r.firstMustMatch||c!==n.length)){if(E++,D())return!1;c-=2,$=!0;break}else if(M&&C&&(!r.i&&M===C||r.i&&M.toLowerCase()===C.toLowerCase())&&(!r.firstMustMatch||c!==n.length)){if(!E&&!r.hungry)return!1;c-=1,$=!0;break}else if(C===void 0&&b>=0&&$&&(!r.firstMustMatch||f)&&(!r.lastMustMatch||g))return e}$||(i=e)}else return e===0&&c===1&&!r.lastMustMatch&&m?0:!1;if(i!==!1&&i!==e&&(i=!1),c<1)return e;e=o(e)}if(c>0)return u&&l==="EOL"?!0:r&&r.maxMismatches>=c&&m?i||0:!1}function V(t,s,n,a,u){if(R(u)&&k(u,"trimBeforeMatching")&&u&&typeof u.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${t}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(u.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let o={...w,...u};if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=N(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map(h=>d(h)?h:String(h)),!d(s)||!s.length)return!1;if(!Number.isInteger(n)||n<0)throw new Error(`string-match-left-right/${t}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof n}, equal to:
11
11
  ${JSON.stringify(n,null,4)}`);let l,r;if(d(a))l=[a];else if(Array.isArray(a))l=a;else if(!a)l=a;else if(typeof a=="function")l=[],l.push(a);else throw new Error(`string-match-left-right/${t}(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ${typeof a}, equal to:
12
12
  ${JSON.stringify(a,null,4)}`);if(u&&!R(u))throw new Error(`string-match-left-right/${t}(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type "${typeof u}", and equal to:
13
13
  ${JSON.stringify(u,null,4)}`);let c=0,E="";if(o?.trimCharsBeforeMatching?.some((h,i)=>h.length>1?(c=i,E=h,!0):!1))throw new Error(`string-match-left-right/${t}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${c} is longer than 1 character, ${E.length} (equals to ${E}). Please split it into separate characters and put into array as separate elements.`);if(!l||!Array.isArray(l)||Array.isArray(l)&&!l.length||Array.isArray(l)&&l.length===1&&d(l[0])&&!l[0].trim()){if(typeof o.cb=="function"){let i,m=n;if((t==="matchLeftIncl"||t==="matchRight")&&(m+=1),t[5]==="L")for(let f=m;f--;){let g=s[f];if((!o.trimBeforeMatching||o.trimBeforeMatching&&g?.trim())&&(!o.trimCharsBeforeMatching?.length||g!==void 0&&!o.trimCharsBeforeMatching.includes(g))){i=f;break}}else if(t.startsWith("matchRight"))for(let f=m;f<s.length;f++){let g=s[f];if((!o.trimBeforeMatching||o.trimBeforeMatching&&g.trim())&&(!o.trimCharsBeforeMatching?.length||!o.trimCharsBeforeMatching.includes(g))){i=f;break}}if(i===void 0)return!1;let b=s[i],e=i+1,$="";return e&&e>0&&($=s.slice(0,e)),t[5]==="L"||i&&i>0&&($=s.slice(i)),o.cb(b,$,i)}let h="";throw u||(h=" More so, the whole options object, the fourth input argument, is missing!"),new Error(`string-match-left-right/${t}(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!${h}`)}for(let h=0,i=l.length;h<i;h++){r=typeof l[h]=="function";let m=l[h],b,e,$="",f=n;t==="matchRight"?f+=1:t==="matchLeft"&&(f-=1);let g=A(s,f,m,o,r,D=>t[5]==="L"?D-1:D+1);if(g&&r&&typeof m=="function"&&m()==="EOL")return m()&&(!o.cb||o.cb(b,$,e))?m():!1;if(Number.isInteger(g)&&(e=t.startsWith("matchLeft")?g-1:g+1,t[5]==="L"?$=s.slice(0,g):$=s.slice(e)),e<0&&(e=void 0),s[e]&&(b=s[e]),Number.isInteger(g)&&(!o.cb||o.cb(b,$,e)))return m}return!1}function H(t,s,n,a){return V("matchLeftIncl",t,s,n,a)}function P(t,s,n,a){return V("matchLeft",t,s,n,a)}function j(t,s,n,a){return V("matchRightIncl",t,s,n,a)}function U(t,s,n,a){return V("matchRight",t,s,n,a)}export{L as defaultGetNextIdx,w as defaults,P as matchLeft,H as matchLeftIncl,U as matchRight,j as matchRightIncl,F as version};
@@ -1,26 +1,26 @@
1
1
  /**
2
2
  * @name string-match-left-right
3
3
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
4
- * @version 9.0.32
5
- * @author Roy Revelt, Codsen Ltd
4
+ * @version 9.0.34
5
+ * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-match-left-right/}
8
8
  */
9
9
 
10
- "use strict";var stringMatchLeftRight=(()=>{var W=Object.create;var w=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var L=(e,t,n)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))x.call(t,n)&&L(e,n,t[n]);if(B)for(var n of B(t))Y.call(t,n)&&L(e,n,t[n]);return e};var K=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),G=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},I=(e,t,n,h)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of q(t))!x.call(e,c)&&c!==n&&w(e,c,{get:()=>t[c],enumerable:!(h=_(t,c))||h.enumerable});return e};var Z=(e,t,n)=>(n=e!=null?W(Q(e)):{},I(t||!e||!e.__esModule?w(n,"default",{value:e,enumerable:!0}):n,e)),z=e=>I(w({},"__esModule",{value:!0}),e);var F=K((he,J)=>{"use strict";J.exports=X;function V(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function X(e){if(e=e||{},e.circles)return ee(e);let t=new Map;if(t.set(Date,o=>new Date(o)),t.set(Map,(o,s)=>new Map(h(Array.from(o),s))),t.set(Set,(o,s)=>new Set(h(Array.from(o),s))),e.constructorHandlers)for(let o of e.constructorHandlers)t.set(o[0],o[1]);let n=null;return e.proto?u:c;function h(o,s){let r=Object.keys(o),i=new Array(r.length);for(let f=0;f<r.length;f++){let l=r[f],g=o[l];typeof g!="object"||g===null?i[l]=g:g.constructor!==Object&&(n=t.get(g.constructor))?i[l]=n(g,s):ArrayBuffer.isView(g)?i[l]=V(g):i[l]=s(g)}return i}function c(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return h(o,c);if(o.constructor!==Object&&(n=t.get(o.constructor)))return n(o,c);let s={};for(let r in o){if(Object.hasOwnProperty.call(o,r)===!1)continue;let i=o[r];typeof i!="object"||i===null?s[r]=i:i.constructor!==Object&&(n=t.get(i.constructor))?s[r]=n(i,c):ArrayBuffer.isView(i)?s[r]=V(i):s[r]=c(i)}return s}function u(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return h(o,u);if(o.constructor!==Object&&(n=t.get(o.constructor)))return n(o,u);let s={};for(let r in o){let i=o[r];typeof i!="object"||i===null?s[r]=i:i.constructor!==Object&&(n=t.get(i.constructor))?s[r]=n(i,u):ArrayBuffer.isView(i)?s[r]=V(i):s[r]=u(i)}return s}}function ee(e){let t=[],n=[],h=new Map;if(h.set(Date,r=>new Date(r)),h.set(Map,(r,i)=>new Map(u(Array.from(r),i))),h.set(Set,(r,i)=>new Set(u(Array.from(r),i))),e.constructorHandlers)for(let r of e.constructorHandlers)h.set(r[0],r[1]);let c=null;return e.proto?s:o;function u(r,i){let f=Object.keys(r),l=new Array(f.length);for(let g=0;g<f.length;g++){let $=f[g],a=r[$];if(typeof a!="object"||a===null)l[$]=a;else if(a.constructor!==Object&&(c=h.get(a.constructor)))l[$]=c(a,i);else if(ArrayBuffer.isView(a))l[$]=V(a);else{let m=t.indexOf(a);m!==-1?l[$]=n[m]:l[$]=i(a)}}return l}function o(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return u(r,o);if(r.constructor!==Object&&(c=h.get(r.constructor)))return c(r,o);let i={};t.push(r),n.push(i);for(let f in r){if(Object.hasOwnProperty.call(r,f)===!1)continue;let l=r[f];if(typeof l!="object"||l===null)i[f]=l;else if(l.constructor!==Object&&(c=h.get(l.constructor)))i[f]=c(l,o);else if(ArrayBuffer.isView(l))i[f]=V(l);else{let g=t.indexOf(l);g!==-1?i[f]=n[g]:i[f]=o(l)}}return t.pop(),n.pop(),i}function s(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return u(r,s);if(r.constructor!==Object&&(c=h.get(r.constructor)))return c(r,s);let i={};t.push(r),n.push(i);for(let f in r){let l=r[f];if(typeof l!="object"||l===null)i[f]=l;else if(l.constructor!==Object&&(c=h.get(l.constructor)))i[f]=c(l,s);else if(ArrayBuffer.isView(l))i[f]=V(l);else{let g=t.indexOf(l);g!==-1?i[f]=n[g]:i[f]=s(l)}}return t.pop(),n.pop(),i}}});var le={};G(le,{defaultGetNextIdx:()=>U,defaults:()=>k,matchLeft:()=>se,matchLeftIncl:()=>oe,matchRight:()=>ae,matchRightIncl:()=>ie,version:()=>re});function j(e){return typeof e!="string"?e:e.length?[e]:[]}var v=Z(F(),1);var fe=(0,v.default)();function A(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)}function M(e){return typeof e=="string"}function H(e,t){return A(e)&&M(t)&&t in e}var P="9.0.32";var re=P,k={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},U=e=>e+1;function ne(e,t,n,h,c=!1,u=U){var b;let o=typeof n=="function"?n():n;if(+t<0&&c&&o==="EOL")return o;let s=O(O({},k),h);if(t>=e.length&&!c)return!1;let r=c?1:n.length,i=0,f=!1,l=!1,g=!1,$=s.maxMismatches,a=t,m=!1,d=!1,p=!1;function E(){return i===1&&$<s.maxMismatches-1}for(;e[a];){let y=u(a);if(s.trimBeforeMatching&&e[a].trim()===""){if(!e[y]&&c&&n==="EOL")return!0;a=u(a);continue}if(s&&!s.i&&((b=s==null?void 0:s.trimCharsBeforeMatching)!=null&&b.includes(e[a]))||s!=null&&s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.map(T=>T.toLowerCase()).includes(e[a].toLowerCase())){if(c&&n==="EOL"&&!e[y])return!0;a=u(a);continue}let N=y>a?n[n.length-r]:n[r-1];if(!s.i&&e[a]===N||s.i&&e[a].toLowerCase()===N.toLowerCase()){if(m||(m=!0),g||(g=!0),r===n.length){if(d=!0,$!==s.maxMismatches)return!1}else r===1&&(p=!0);if(r-=1,i++,E())return!1;if(!r)return i!==n.length||$===s.maxMismatches||!f?a:!1}else if(!f&&!i&&(f=!0),s.maxMismatches&&$&&a){$-=1;for(let T=0;T<=$;T++){let D=y>a?n[n.length-r+1+T]:n[r-2-T],R=e[u(a)];if(D&&(!s.i&&e[a]===D||s.i&&e[a].toLowerCase()===D.toLowerCase())&&(!s.firstMustMatch||r!==n.length)){if(i++,E())return!1;r-=2,m=!0;break}else if(R&&D&&(!s.i&&R===D||s.i&&R.toLowerCase()===D.toLowerCase())&&(!s.firstMustMatch||r!==n.length)){if(!i&&!s.hungry)return!1;r-=1,m=!0;break}else if(D===void 0&&$>=0&&m&&(!s.firstMustMatch||d)&&(!s.lastMustMatch||p))return a}m||(l=a)}else return a===0&&r===1&&!s.lastMustMatch&&g?0:!1;if(l!==!1&&l!==a&&(l=!1),r<1)return a;a=u(a)}if(r>0)return c&&o==="EOL"?!0:s&&s.maxMismatches>=r&&g?l||0:!1}function S(e,t,n,h,c){var f,l,g;if(A(c)&&H(c,"trimBeforeMatching")&&c&&typeof c.trimBeforeMatching!="boolean")throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!").concat(Array.isArray(c.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""));let u=O(O({},k),c);if(typeof u.trimCharsBeforeMatching=="string"&&(u.trimCharsBeforeMatching=j(u.trimCharsBeforeMatching)),u.trimCharsBeforeMatching=u.trimCharsBeforeMatching.map($=>M($)?$:String($)),!M(t)||!t.length)return!1;if(!Number.isInteger(n)||n<0)throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ").concat(typeof n,", equal to:\n").concat(JSON.stringify(n,null,4)));let o,s;if(M(h))o=[h];else if(Array.isArray(h))o=h;else if(!h)o=h;else if(typeof h=="function")o=[],o.push(h);else throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ").concat(typeof h,", equal to:\n").concat(JSON.stringify(h,null,4)));if(c&&!A(c))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type \"").concat(typeof c,'", and equal to:\n').concat(JSON.stringify(c,null,4)));let r=0,i="";if((f=u==null?void 0:u.trimCharsBeforeMatching)!=null&&f.some(($,a)=>$.length>1?(r=a,i=$,!0):!1))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ").concat(r," is longer than 1 character, ").concat(i.length," (equals to ").concat(i,"). Please split it into separate characters and put into array as separate elements."));if(!o||!Array.isArray(o)||Array.isArray(o)&&!o.length||Array.isArray(o)&&o.length===1&&M(o[0])&&!o[0].trim()){if(typeof u.cb=="function"){let a,m=n;if((e==="matchLeftIncl"||e==="matchRight")&&(m+=1),e[5]==="L")for(let C=m;C--;){let b=t[C];if((!u.trimBeforeMatching||u.trimBeforeMatching&&(b!=null&&b.trim()))&&(!((l=u.trimCharsBeforeMatching)!=null&&l.length)||b!==void 0&&!u.trimCharsBeforeMatching.includes(b))){a=C;break}}else if(e.startsWith("matchRight"))for(let C=m;C<t.length;C++){let b=t[C];if((!u.trimBeforeMatching||u.trimBeforeMatching&&b.trim())&&(!((g=u.trimCharsBeforeMatching)!=null&&g.length)||!u.trimCharsBeforeMatching.includes(b))){a=C;break}}if(a===void 0)return!1;let d=t[a],p=a+1,E="";return p&&p>0&&(E=t.slice(0,p)),e[5]==="L"||a&&a>0&&(E=t.slice(a)),u.cb(d,E,a)}let $="";throw c||($=" More so, the whole options object, the fourth input argument, is missing!"),new Error("string-match-left-right/".concat(e,'(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!').concat($))}for(let $=0,a=o.length;$<a;$++){s=typeof o[$]=="function";let m=o[$],d,p,E="",C=n;e==="matchRight"?C+=1:e==="matchLeft"&&(C-=1);let b=ne(t,C,m,u,s,y=>e[5]==="L"?y-1:y+1);if(b&&s&&typeof m=="function"&&m()==="EOL")return m()&&(!u.cb||u.cb(d,E,p))?m():!1;if(Number.isInteger(b)&&(p=e.startsWith("matchLeft")?b-1:b+1,e[5]==="L"?E=t.slice(0,b):E=t.slice(p)),p<0&&(p=void 0),t[p]&&(d=t[p]),Number.isInteger(b)&&(!u.cb||u.cb(d,E,p)))return m}return!1}function oe(e,t,n,h){return S("matchLeftIncl",e,t,n,h)}function se(e,t,n,h){return S("matchLeft",e,t,n,h)}function ie(e,t,n,h){return S("matchRightIncl",e,t,n,h)}function ae(e,t,n,h){return S("matchRight",e,t,n,h)}return z(le);})();
10
+ "use strict";var stringMatchLeftRight=(()=>{var W=Object.create;var w=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var L=(e,t,n)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))x.call(t,n)&&L(e,n,t[n]);if(B)for(var n of B(t))Y.call(t,n)&&L(e,n,t[n]);return e};var K=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),G=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},I=(e,t,n,h)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of q(t))!x.call(e,c)&&c!==n&&w(e,c,{get:()=>t[c],enumerable:!(h=_(t,c))||h.enumerable});return e};var Z=(e,t,n)=>(n=e!=null?W(Q(e)):{},I(t||!e||!e.__esModule?w(n,"default",{value:e,enumerable:!0}):n,e)),z=e=>I(w({},"__esModule",{value:!0}),e);var F=K((he,J)=>{"use strict";J.exports=X;function V(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function X(e){if(e=e||{},e.circles)return ee(e);let t=new Map;if(t.set(Date,o=>new Date(o)),t.set(Map,(o,s)=>new Map(h(Array.from(o),s))),t.set(Set,(o,s)=>new Set(h(Array.from(o),s))),e.constructorHandlers)for(let o of e.constructorHandlers)t.set(o[0],o[1]);let n=null;return e.proto?u:c;function h(o,s){let r=Object.keys(o),i=new Array(r.length);for(let f=0;f<r.length;f++){let l=r[f],g=o[l];typeof g!="object"||g===null?i[l]=g:g.constructor!==Object&&(n=t.get(g.constructor))?i[l]=n(g,s):ArrayBuffer.isView(g)?i[l]=V(g):i[l]=s(g)}return i}function c(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return h(o,c);if(o.constructor!==Object&&(n=t.get(o.constructor)))return n(o,c);let s={};for(let r in o){if(Object.hasOwnProperty.call(o,r)===!1)continue;let i=o[r];typeof i!="object"||i===null?s[r]=i:i.constructor!==Object&&(n=t.get(i.constructor))?s[r]=n(i,c):ArrayBuffer.isView(i)?s[r]=V(i):s[r]=c(i)}return s}function u(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return h(o,u);if(o.constructor!==Object&&(n=t.get(o.constructor)))return n(o,u);let s={};for(let r in o){let i=o[r];typeof i!="object"||i===null?s[r]=i:i.constructor!==Object&&(n=t.get(i.constructor))?s[r]=n(i,u):ArrayBuffer.isView(i)?s[r]=V(i):s[r]=u(i)}return s}}function ee(e){let t=[],n=[],h=new Map;if(h.set(Date,r=>new Date(r)),h.set(Map,(r,i)=>new Map(u(Array.from(r),i))),h.set(Set,(r,i)=>new Set(u(Array.from(r),i))),e.constructorHandlers)for(let r of e.constructorHandlers)h.set(r[0],r[1]);let c=null;return e.proto?s:o;function u(r,i){let f=Object.keys(r),l=new Array(f.length);for(let g=0;g<f.length;g++){let $=f[g],a=r[$];if(typeof a!="object"||a===null)l[$]=a;else if(a.constructor!==Object&&(c=h.get(a.constructor)))l[$]=c(a,i);else if(ArrayBuffer.isView(a))l[$]=V(a);else{let m=t.indexOf(a);m!==-1?l[$]=n[m]:l[$]=i(a)}}return l}function o(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return u(r,o);if(r.constructor!==Object&&(c=h.get(r.constructor)))return c(r,o);let i={};t.push(r),n.push(i);for(let f in r){if(Object.hasOwnProperty.call(r,f)===!1)continue;let l=r[f];if(typeof l!="object"||l===null)i[f]=l;else if(l.constructor!==Object&&(c=h.get(l.constructor)))i[f]=c(l,o);else if(ArrayBuffer.isView(l))i[f]=V(l);else{let g=t.indexOf(l);g!==-1?i[f]=n[g]:i[f]=o(l)}}return t.pop(),n.pop(),i}function s(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return u(r,s);if(r.constructor!==Object&&(c=h.get(r.constructor)))return c(r,s);let i={};t.push(r),n.push(i);for(let f in r){let l=r[f];if(typeof l!="object"||l===null)i[f]=l;else if(l.constructor!==Object&&(c=h.get(l.constructor)))i[f]=c(l,s);else if(ArrayBuffer.isView(l))i[f]=V(l);else{let g=t.indexOf(l);g!==-1?i[f]=n[g]:i[f]=s(l)}}return t.pop(),n.pop(),i}}});var le={};G(le,{defaultGetNextIdx:()=>U,defaults:()=>k,matchLeft:()=>se,matchLeftIncl:()=>oe,matchRight:()=>ae,matchRightIncl:()=>ie,version:()=>re});function j(e){return typeof e!="string"?e:e.length?[e]:[]}var v=Z(F(),1);var fe=(0,v.default)();function A(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)}function M(e){return typeof e=="string"}function H(e,t){return A(e)&&M(t)&&t in e}var P="9.0.34";var re=P,k={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},U=e=>e+1;function ne(e,t,n,h,c=!1,u=U){var b;let o=typeof n=="function"?n():n;if(+t<0&&c&&o==="EOL")return o;let s=O(O({},k),h);if(t>=e.length&&!c)return!1;let r=c?1:n.length,i=0,f=!1,l=!1,g=!1,$=s.maxMismatches,a=t,m=!1,d=!1,p=!1;function E(){return i===1&&$<s.maxMismatches-1}for(;e[a];){let y=u(a);if(s.trimBeforeMatching&&e[a].trim()===""){if(!e[y]&&c&&n==="EOL")return!0;a=u(a);continue}if(s&&!s.i&&((b=s==null?void 0:s.trimCharsBeforeMatching)!=null&&b.includes(e[a]))||s!=null&&s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.map(T=>T.toLowerCase()).includes(e[a].toLowerCase())){if(c&&n==="EOL"&&!e[y])return!0;a=u(a);continue}let N=y>a?n[n.length-r]:n[r-1];if(!s.i&&e[a]===N||s.i&&e[a].toLowerCase()===N.toLowerCase()){if(m||(m=!0),g||(g=!0),r===n.length){if(d=!0,$!==s.maxMismatches)return!1}else r===1&&(p=!0);if(r-=1,i++,E())return!1;if(!r)return i!==n.length||$===s.maxMismatches||!f?a:!1}else if(!f&&!i&&(f=!0),s.maxMismatches&&$&&a){$-=1;for(let T=0;T<=$;T++){let D=y>a?n[n.length-r+1+T]:n[r-2-T],R=e[u(a)];if(D&&(!s.i&&e[a]===D||s.i&&e[a].toLowerCase()===D.toLowerCase())&&(!s.firstMustMatch||r!==n.length)){if(i++,E())return!1;r-=2,m=!0;break}else if(R&&D&&(!s.i&&R===D||s.i&&R.toLowerCase()===D.toLowerCase())&&(!s.firstMustMatch||r!==n.length)){if(!i&&!s.hungry)return!1;r-=1,m=!0;break}else if(D===void 0&&$>=0&&m&&(!s.firstMustMatch||d)&&(!s.lastMustMatch||p))return a}m||(l=a)}else return a===0&&r===1&&!s.lastMustMatch&&g?0:!1;if(l!==!1&&l!==a&&(l=!1),r<1)return a;a=u(a)}if(r>0)return c&&o==="EOL"?!0:s&&s.maxMismatches>=r&&g?l||0:!1}function S(e,t,n,h,c){var f,l,g;if(A(c)&&H(c,"trimBeforeMatching")&&c&&typeof c.trimBeforeMatching!="boolean")throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!").concat(Array.isArray(c.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""));let u=O(O({},k),c);if(typeof u.trimCharsBeforeMatching=="string"&&(u.trimCharsBeforeMatching=j(u.trimCharsBeforeMatching)),u.trimCharsBeforeMatching=u.trimCharsBeforeMatching.map($=>M($)?$:String($)),!M(t)||!t.length)return!1;if(!Number.isInteger(n)||n<0)throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ").concat(typeof n,", equal to:\n").concat(JSON.stringify(n,null,4)));let o,s;if(M(h))o=[h];else if(Array.isArray(h))o=h;else if(!h)o=h;else if(typeof h=="function")o=[],o.push(h);else throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ").concat(typeof h,", equal to:\n").concat(JSON.stringify(h,null,4)));if(c&&!A(c))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type \"").concat(typeof c,'", and equal to:\n').concat(JSON.stringify(c,null,4)));let r=0,i="";if((f=u==null?void 0:u.trimCharsBeforeMatching)!=null&&f.some(($,a)=>$.length>1?(r=a,i=$,!0):!1))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ").concat(r," is longer than 1 character, ").concat(i.length," (equals to ").concat(i,"). Please split it into separate characters and put into array as separate elements."));if(!o||!Array.isArray(o)||Array.isArray(o)&&!o.length||Array.isArray(o)&&o.length===1&&M(o[0])&&!o[0].trim()){if(typeof u.cb=="function"){let a,m=n;if((e==="matchLeftIncl"||e==="matchRight")&&(m+=1),e[5]==="L")for(let C=m;C--;){let b=t[C];if((!u.trimBeforeMatching||u.trimBeforeMatching&&(b!=null&&b.trim()))&&(!((l=u.trimCharsBeforeMatching)!=null&&l.length)||b!==void 0&&!u.trimCharsBeforeMatching.includes(b))){a=C;break}}else if(e.startsWith("matchRight"))for(let C=m;C<t.length;C++){let b=t[C];if((!u.trimBeforeMatching||u.trimBeforeMatching&&b.trim())&&(!((g=u.trimCharsBeforeMatching)!=null&&g.length)||!u.trimCharsBeforeMatching.includes(b))){a=C;break}}if(a===void 0)return!1;let d=t[a],p=a+1,E="";return p&&p>0&&(E=t.slice(0,p)),e[5]==="L"||a&&a>0&&(E=t.slice(a)),u.cb(d,E,a)}let $="";throw c||($=" More so, the whole options object, the fourth input argument, is missing!"),new Error("string-match-left-right/".concat(e,'(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!').concat($))}for(let $=0,a=o.length;$<a;$++){s=typeof o[$]=="function";let m=o[$],d,p,E="",C=n;e==="matchRight"?C+=1:e==="matchLeft"&&(C-=1);let b=ne(t,C,m,u,s,y=>e[5]==="L"?y-1:y+1);if(b&&s&&typeof m=="function"&&m()==="EOL")return m()&&(!u.cb||u.cb(d,E,p))?m():!1;if(Number.isInteger(b)&&(p=e.startsWith("matchLeft")?b-1:b+1,e[5]==="L"?E=t.slice(0,b):E=t.slice(p)),p<0&&(p=void 0),t[p]&&(d=t[p]),Number.isInteger(b)&&(!u.cb||u.cb(d,E,p)))return m}return!1}function oe(e,t,n,h){return S("matchLeftIncl",e,t,n,h)}function se(e,t,n,h){return S("matchLeft",e,t,n,h)}function ie(e,t,n,h){return S("matchRightIncl",e,t,n,h)}function ae(e,t,n,h){return S("matchRight",e,t,n,h)}return z(le);})();
11
11
  /**
12
12
  * @name arrayiffy-if-string
13
13
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
14
- * @version 5.0.19
15
- * @author Roy Revelt, Codsen Ltd
14
+ * @version 5.0.21
15
+ * @author Roy Revelt
16
16
  * @license MIT
17
17
  * {@link https://codsen.com/os/arrayiffy-if-string/}
18
18
  */
19
19
  /**
20
20
  * @name codsen-utils
21
21
  * @fileoverview Various utility functions
22
- * @version 1.6.17
23
- * @author Roy Revelt, Codsen Ltd
22
+ * @version 1.6.19
23
+ * @author Roy Revelt
24
24
  * @license MIT
25
25
  * {@link https://codsen.com/os/codsen-utils/}
26
26
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-match-left-right",
3
- "version": "9.0.32",
3
+ "version": "9.0.34",
4
4
  "description": "Match substrings on the left or right of a given index, ignoring whitespace",
5
5
  "keywords": [
6
6
  "left",
@@ -41,7 +41,7 @@
41
41
  "examples": "node '../../ops/scripts/run-examples.js'",
42
42
  "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
43
43
  "letspublish": "npm publish --provenance || :",
44
- "lint": "eslint . --fix",
44
+ "lint": "eslint . --fix --concurrency=auto --cache",
45
45
  "perf": "node perf/check.js",
46
46
  "prep": "echo 'ready'",
47
47
  "prettier": "prettier",
@@ -68,9 +68,9 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "arrayiffy-if-string": "^5.0.19",
72
- "codsen-utils": "^1.6.17",
73
- "string-character-is-astral-surrogate": "^3.0.20"
71
+ "arrayiffy-if-string": "^5.0.21",
72
+ "codsen-utils": "^1.6.19",
73
+ "string-character-is-astral-surrogate": "^3.0.22"
74
74
  },
75
75
  "publishConfig": {
76
76
  "registry": "https://registry.npmjs.org/"