json-variables 11.1.8 → 11.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -12,7 +12,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
12
12
 
13
13
  ## 11.0.16 (2022-04-18)
14
14
 
15
- ### Bug Fixes
15
+ ### Fixed
16
16
 
17
17
  - tweak types ([5da8102](https://github.com/codsen/codsen/commit/5da8102fa04b52c63b5a7a32733aaf8eace13569))
18
18
 
@@ -24,7 +24,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
24
24
 
25
25
  ### BREAKING CHANGES
26
26
 
27
- - programs now are in ES Modules and won't work with Common JS require()
27
+ - programs now are in ES Modules and won't work with Common JS `require()`
28
28
 
29
29
  ## 10.1.0 (2021-05-24)
30
30
 
@@ -40,9 +40,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
40
40
 
41
41
  ## 10.0.1 (2021-01-28)
42
42
 
43
- ### Bug Fixes
43
+ ### Fixed
44
44
 
45
- - add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
45
+ - add `testStats` to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
46
46
 
47
47
  ## 10.0.0 (2021-01-23)
48
48
 
@@ -56,7 +56,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
56
56
 
57
57
  ## 9.0.0 (2020-11-28)
58
58
 
59
- Accidental version bump during migration to sourcehut. Sorry about that.
59
+ Accidental version bump during migration to SourceHut. Sorry about that.
60
60
 
61
61
  ## 8.2.0 (2020-04-19)
62
62
 
@@ -124,13 +124,13 @@ Accidental version bump during migration to sourcehut. Sorry about that.
124
124
 
125
125
  **Small but nonetheless breaking changes.**
126
126
 
127
- ### Changed
127
+ ### Changes
128
128
 
129
129
  - 💥 Mismatching wrapping/nonwrapping heads and tails are not permitted any more. Either both are wrapping or both are non-wrapping. If you used this library in normal ways you should not see the difference. The benefits of this changes are huge - 💥 We have completely rehauled _head_ and _tail_ detection (see below) and accepting only matching pairs allows us to identify more false-positives.
130
130
 
131
131
  **PS. Bumping _semver major_ just in case (could have bumped minor) but let's better be safe than sorry** 😉
132
132
 
133
- ### Improved
133
+ ### Improvements
134
134
 
135
135
  - Improved _head_ and _tail_ detection algorithm. Previously we used simple string search, without considering the order of the findings. Wrong order now will help to rule-out more false positives.
136
136
  - Tapped [ast-monkey-traverse](https://www.npmjs.com/package/ast-monkey-traverse) directly, without the need for the whole [ast-monkey](https://www.npmjs.com/package/ast-monkey).
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name json-variables
3
3
  * @fileoverview Resolves custom-marked, cross-referenced paths in parsed JSON
4
- * @version 11.1.8
4
+ * @version 11.1.10
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/json-variables/}
8
8
  */
9
9
 
10
- import{traverse as C}from"ast-monkey-traverse";import{isMatch as x}from"matcher";import h from"object-path";import{arrayiffy as F}from"arrayiffy-if-string";import{strFindHeadsTails as I}from"string-find-heads-tails";import{getByKey as _}from"ast-get-values-by-key";import{Ranges as B}from"ranges-push";import{rApply as A}from"ranges-apply";import{remDup as L}from"string-remove-duplicate-heads-tails";import{matchLeftIncl as U,matchRightIncl as M}from"string-match-left-right";var j="11.1.8";var he=j,q=Object.prototype.hasOwnProperty,K={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function g(e){return typeof e=="string"}function G(e){return typeof e=="number"}function O(e){return typeof e=="boolean"}function N(e){return e===null}function V(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function z(e){return e!=null}function u(e){return g(e)?e.trim():e}function Y(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(0,t)}return e}function Q(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(t+1)}return e}function J(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(0,t)}return e}function P(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(t+1)}return e}function T(e,t){return typeof e!="string"||!e.trim()?!1:!!(e.includes(t.heads)||e.includes(t.tails)||g(t.headsNoWrap)&&t.headsNoWrap.length&&e.includes(t.headsNoWrap)||g(t.tailsNoWrap)&&t.tailsNoWrap.length&&e.includes(t.tailsNoWrap))}function X(e,t,r){let o,i;return typeof e=="string"&&e.length&&M(e,0,t,{trimBeforeMatching:!0,cb:(n,a,l)=>(o=l,!0)})&&U(e,e.length-1,r,{trimBeforeMatching:!0,cb:(n,a,l)=>(i=(l||0)+1,!0)})?e.slice(o,i):e}function H(e,t,r=!1,o,i,n){if(t.wrapHeadsWith||(t.wrapHeadsWith=""),t.wrapTailsWith||(t.wrapTailsWith=""),g(e)&&!r&&t.wrapGlobalFlipSwitch&&!t.dontWrapVars.some(a=>x(n,a))&&(!t.preventDoubleWrapping||t.preventDoubleWrapping&&g(e)&&!e.includes(t.wrapHeadsWith)&&!e.includes(t.wrapTailsWith)))return`${t.wrapHeadsWith}${e}${t.wrapTailsWith}`;if(r){if(!g(e))return e;let a=L(e,{heads:t.wrapHeadsWith,tails:t.wrapTailsWith});return g(a)?X(a,t.wrapHeadsWith,t.wrapTailsWith):a}return e}function Z(e,t,r,o){let i;if(r.indexOf(".")!==-1){let n=r,a=!0;if(o.lookForDataContainers&&typeof o.dataContainerIdentifierTails=="string"&&o.dataContainerIdentifierTails.length&&!n.endsWith(o.dataContainerIdentifierTails)){let l=h.get(e,n+o.dataContainerIdentifierTails);V(l)&&h.get(l,t)&&(i=h.get(l,t),a=!1)}for(;a&&n.indexOf(".")!==-1;){if(n=J(n),P(n)===t)throw new Error(`json-variables/findValues(): [THROW_ID_20] While trying to resolve: "${t}" at path "${r}", we encountered a closed loop. The parent key "${P(n)}" is called the same as the variable "${t}" we're looking for.`);if(o.lookForDataContainers&&typeof o.dataContainerIdentifierTails=="string"&&o.dataContainerIdentifierTails.length&&!n.endsWith(o.dataContainerIdentifierTails)){let l=h.get(e,n+o.dataContainerIdentifierTails);V(l)&&h.get(l,t)&&(i=h.get(l,t),a=!1)}if(i===void 0){let l=h.get(e,n);V(l)&&h.get(l,t)&&(i=h.get(l,t),a=!1)}}}if(i===void 0){let n=h.get(e,t);n!==void 0&&(i=n)}if(i===void 0)if(t.indexOf(".")===-1){let n=_(e,t);if(n.length){for(let a=0,l=n.length;a<l;a++)if(g(n[a].val)||O(n[a].val)||N(n[a].val)){i=n[a].val;break}else if(G(n[a].val)){i=String(n[a].val);break}else if(Array.isArray(n[a].val)){i=n[a].val.join("");break}}}else{let n=_(e,Y(t));if(n.length)for(let a=0,l=n.length;a<l;a++){let y=h.get(n[a].val,Q(t));y&&g(y)&&(i=y)}}return i}function R(e,t,r,o,i=[]){if(i.includes(r)){let c="";if(i.length>1){let w=` \u2192
10
+ import{traverse as C}from"ast-monkey-traverse";import{isMatch as x}from"matcher";import h from"object-path";import{arrayiffy as F}from"arrayiffy-if-string";import{strFindHeadsTails as I}from"string-find-heads-tails";import{getByKey as _}from"ast-get-values-by-key";import{Ranges as B}from"ranges-push";import{rApply as A}from"ranges-apply";import{remDup as L}from"string-remove-duplicate-heads-tails";import{matchLeftIncl as U,matchRightIncl as M}from"string-match-left-right";var j="11.1.10";var he=j,q=Object.prototype.hasOwnProperty,K={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function g(e){return typeof e=="string"}function G(e){return typeof e=="number"}function O(e){return typeof e=="boolean"}function N(e){return e===null}function V(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function z(e){return e!=null}function u(e){return g(e)?e.trim():e}function Y(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(0,t)}return e}function Q(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(t+1)}return e}function J(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(0,t)}return e}function P(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(t+1)}return e}function T(e,t){return typeof e!="string"||!e.trim()?!1:!!(e.includes(t.heads)||e.includes(t.tails)||g(t.headsNoWrap)&&t.headsNoWrap.length&&e.includes(t.headsNoWrap)||g(t.tailsNoWrap)&&t.tailsNoWrap.length&&e.includes(t.tailsNoWrap))}function X(e,t,r){let o,i;return typeof e=="string"&&e.length&&M(e,0,t,{trimBeforeMatching:!0,cb:(n,a,l)=>(o=l,!0)})&&U(e,e.length-1,r,{trimBeforeMatching:!0,cb:(n,a,l)=>(i=(l||0)+1,!0)})?e.slice(o,i):e}function H(e,t,r=!1,o,i,n){if(t.wrapHeadsWith||(t.wrapHeadsWith=""),t.wrapTailsWith||(t.wrapTailsWith=""),g(e)&&!r&&t.wrapGlobalFlipSwitch&&!t.dontWrapVars.some(a=>x(n,a))&&(!t.preventDoubleWrapping||t.preventDoubleWrapping&&g(e)&&!e.includes(t.wrapHeadsWith)&&!e.includes(t.wrapTailsWith)))return`${t.wrapHeadsWith}${e}${t.wrapTailsWith}`;if(r){if(!g(e))return e;let a=L(e,{heads:t.wrapHeadsWith,tails:t.wrapTailsWith});return g(a)?X(a,t.wrapHeadsWith,t.wrapTailsWith):a}return e}function Z(e,t,r,o){let i;if(r.indexOf(".")!==-1){let n=r,a=!0;if(o.lookForDataContainers&&typeof o.dataContainerIdentifierTails=="string"&&o.dataContainerIdentifierTails.length&&!n.endsWith(o.dataContainerIdentifierTails)){let l=h.get(e,n+o.dataContainerIdentifierTails);V(l)&&h.get(l,t)&&(i=h.get(l,t),a=!1)}for(;a&&n.indexOf(".")!==-1;){if(n=J(n),P(n)===t)throw new Error(`json-variables/findValues(): [THROW_ID_20] While trying to resolve: "${t}" at path "${r}", we encountered a closed loop. The parent key "${P(n)}" is called the same as the variable "${t}" we're looking for.`);if(o.lookForDataContainers&&typeof o.dataContainerIdentifierTails=="string"&&o.dataContainerIdentifierTails.length&&!n.endsWith(o.dataContainerIdentifierTails)){let l=h.get(e,n+o.dataContainerIdentifierTails);V(l)&&h.get(l,t)&&(i=h.get(l,t),a=!1)}if(i===void 0){let l=h.get(e,n);V(l)&&h.get(l,t)&&(i=h.get(l,t),a=!1)}}}if(i===void 0){let n=h.get(e,t);n!==void 0&&(i=n)}if(i===void 0)if(t.indexOf(".")===-1){let n=_(e,t);if(n.length){for(let a=0,l=n.length;a<l;a++)if(g(n[a].val)||O(n[a].val)||N(n[a].val)){i=n[a].val;break}else if(G(n[a].val)){i=String(n[a].val);break}else if(Array.isArray(n[a].val)){i=n[a].val.join("");break}}}else{let n=_(e,Y(t));if(n.length)for(let a=0,l=n.length;a<l;a++){let y=h.get(n[a].val,Q(t));y&&g(y)&&(i=y)}}return i}function R(e,t,r,o,i=[]){if(i.includes(r)){let c="";if(i.length>1){let w=` \u2192
11
11
  `;c=i.reduce((D,b,S)=>D+(S===0?"":w)+(b===r?"\u{1F4A5} ":" ")+b,` Here's the path we travelled up until we hit the recursion:
12
12
 
13
13
  `),c+=`${w}\u{1F4A5} ${r}`}throw new Error(`json-variables/resolveString(): [THROW_ID_19] While trying to resolve: "${t}" at path "${r}", we encountered a closed loop, the key is referencing itself."${c}`)}let n={},a=Array.from(i);a.push(r);let l=new B;function y(c,w,D){for(let b=0,S=c.length;b<S;b++){let f=c[b],p=t.slice(f.headsEndAt,f.tailsStartAt);if(p.length===0)l.push(f.headsStartAt,f.tailsEndAt);else if(q.call(n,p)&&g(n[p]))l.push(f.headsStartAt,f.tailsEndAt,n[p]);else{let s=Z(e,p.trim(),r,o);if(s===void 0)if(o.allowUnresolved===!0)s="";else if(typeof o.allowUnresolved=="string")s=o.allowUnresolved;else throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_18] We couldn't find the value to resolve the variable ${t.slice(f.headsEndAt,f.tailsStartAt)}. We're at path: "${r}".`);if(!D&&o.throwWhenNonStringInsertedInString&&!g(s))throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_23] While resolving the variable ${t.slice(f.headsEndAt,f.tailsStartAt)} at path ${r}, it resolved into a non-string value, ${JSON.stringify(s,null,4)}. This is happening because options setting "throwWhenNonStringInsertedInString" is active (set to "true").`);if(O(s)){if(o.resolveToBoolIfAnyValuesContainBool)return l.wipe(),o.resolveToFalseIfAnyValuesContainBool?!1:s;s=""}else{if(N(s)&&D)return l.wipe(),s;Array.isArray(s)?s=String(s.join("")):N(s)?s="":s=String(s)}let v=r.includes(".")?`${J(r)}.${p}`:p;if(T(s,o)){let m=H(R(e,s,v,o,a),o,w,a,v,p.trim());typeof m=="string"&&l.push(f.headsStartAt,f.tailsEndAt,m)}else{n[p]=s;let m=H(s,o,w,a,v,p.trim());typeof m=="string"&&l.push(f.headsStartAt,f.tailsEndAt,m)}}}}let d;try{d=I(t,o.heads,o.tails,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(c){throw new Error(`json-variables/resolveString(): [THROW_ID_17] While trying to resolve string: "${t}" at path ${r}, something wrong with heads and tails was detected! Here's the internal error message:
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @name json-variables
3
3
  * @fileoverview Resolves custom-marked, cross-referenced paths in parsed JSON
4
- * @version 11.1.8
4
+ * @version 11.1.10
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/json-variables/}
@@ -37,7 +37,7 @@ ${JSON.stringify(t,null,4)} (type ${typeof t})`);else i=$({},Gt);let l=e.filter(
37
37
  ${JSON.stringify(r,null,4)}`);if(C(this.ranges)&&Array.isArray(this.last())&&i===this.last()[1]){if(this.last()[1]=l,this.last()[2],this.last()[2]!==null&&C(r)){let o=this.last()[2]&&this.last()[2].length&&(!((n=this.opts)!=null&&n.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(o=pe(o,this.opts.limitLinebreaksCount)),X(o)&&!o.length||(this.last()[2]=o)}}else{this.ranges||(this.ranges=[]);let o=r!==void 0&&!(X(r)&&!r.length)?[i,l,r&&this.opts.limitToBeAddedWhitespace?pe(r,this.opts.limitLinebreaksCount):r]:[i,l];this.ranges.push(o)}}else throw j(i)&&i>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof l}" equal to: ${JSON.stringify(l,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof i}" equal to: ${JSON.stringify(i,null,4)}`)}push(e,t,r){this.add(e,t,r)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=si(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>C(e[2])?[e[0],e[1],pe(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&j(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var li={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Fe(e,t){if(!Array.isArray(e)||!e.length)return e;let r=$($({},li),t),i,l;if(r.strictlyTwoElementsInRangeArrays&&!e.every((a,g)=>!Array.isArray(a)||a.length!==2?(i=g,l=a.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${i}th range (${JSON.stringify(e[i],null,4)}) has not two but ${l} elements!`);if(!e.every((a,g)=>!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(i=g,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${i}th range (${JSON.stringify(e[i],null,4)}) does not consist of only natural numbers!`);let n=e.length**2,o=0;return Array.from(e).sort((a,g)=>(r.progressFn&&(o+=1,r.progressFn(Math.floor(o*100/n))),a[0]===g[0]?a[1]<g[1]?-1:a[1]>g[1]?1:0:a[0]<g[0]?-1:1))}var zt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Yt(e,t){function r(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let i;if(t)if(r(t)){if(i=$($({},zt),t),i.progressFn&&r(i.progressFn)&&!Object.keys(i.progressFn).length)i.progressFn=null;else if(i.progressFn&&typeof i.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof i.progressFn}", equal to ${JSON.stringify(i.progressFn,null,4)}`);if(![1,2,"1","2"].includes(i.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof i.mergeType}", equal to ${JSON.stringify(i.mergeType,null,4)}`);if(typeof i.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof i.joinRangesThatTouchEdges}", equal to ${JSON.stringify(i.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
38
38
  ${JSON.stringify(t,null,4)} (type ${typeof t})`);else i=$({},zt);let l=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),n,o,a;i.progressFn?n=Fe(l,{progressFn:s=>{a=Math.floor(s/5),a!==o&&(o=a,i.progressFn(a))}}):n=Fe(l);let g=n.length-1;for(let s=g;s>0;s--)i.progressFn&&(a=Math.floor((1-s/g)*78)+21,a!==o&&a>o&&(o=a,i.progressFn(a))),(n[s][0]<=n[s-1][0]||!i.joinRangesThatTouchEdges&&n[s][0]<n[s-1][1]||i.joinRangesThatTouchEdges&&n[s][0]<=n[s-1][1])&&(n[s-1][0]=Math.min(n[s][0],n[s-1][0]),n[s-1][1]=Math.max(n[s][1],n[s-1][1]),n[s][2]!==void 0&&(n[s-1][0]>=n[s][0]||n[s-1][1]<=n[s][1])&&n[s-1][2]!==null&&(n[s][2]===null&&n[s-1][2]!==null?n[s-1][2]=null:n[s-1][2]!=null?+i.mergeType==2&&n[s-1][0]===n[s][0]?n[s-1][2]=n[s][2]:n[s-1][2]+=n[s][2]:n[s-1][2]=n[s][2]),n.splice(s,1),s=n.length);return n.length?n:null}var fi=!0,ke="Invariant failed";function Xt(e,t){if(!e){if(fi)throw new Error(ke);var r=typeof t=="function"?t():t,i=r?"".concat(ke,": ").concat(r):ke;throw new Error(i)}}function L(e,t,r){let i=0,l=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(t&&!Array.isArray(t))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof t}, equal to: ${JSON.stringify(t,null,4)}`);if(r&&typeof r!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(!t||!t.filter(h=>h).length)return e;let n;Array.isArray(t)&&Number.isInteger(t[0])&&Number.isInteger(t[1])?n=[Array.from(t)]:n=Array.from(t);let o=n.length,a=0;n.filter(h=>h).forEach((h,c)=>{if(r&&(i=Math.floor(a/o*10),i!==l&&(l=i,r(i))),!Array.isArray(h))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${c}th element not an array: ${JSON.stringify(h,null,4)}, which is ${typeof h}`);if(!Number.isInteger(h[0])){if(!Number.isInteger(+h[0])||+h[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${c}th element, array ${JSON.stringify(h,null,0)}. Its first element is not an integer, string index, but ${typeof h[0]}, equal to: ${JSON.stringify(h[0],null,4)}.`);n[c][0]=+n[c][0]}if(!Number.isInteger(h[1])){if(!Number.isInteger(+h[1])||+h[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${c}th element, array ${JSON.stringify(h,null,0)}. Its second element is not an integer, string index, but ${typeof h[1]}, equal to: ${JSON.stringify(h[1],null,4)}.`);n[c][1]=+n[c][1]}a+=1});let g=Yt(n,{progressFn:h=>{r&&(i=10+Math.floor(h/10),i!==l&&(l=i,r(i)))}});Xt(g);let s=g.length;if(s>0){let h=e.slice(g[s-1][1]);e=g.reduce((c,T,y,u)=>{r&&(i=20+Math.floor(y/s*80),i!==l&&(l=i,r(i)));let w=y===0?0:u[y-1][1],d=u[y][0];return`${c}${e.slice(w,d)}${u[y][2]||""}`},""),e+=h}return e}var Zt=U(je(),1);var ui={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function Q(e,t){if(typeof e!="string")throw new Error(`string-trim-spaces-only: [THROW_ID_01] input must be string! It was given as ${typeof e}, equal to:
39
39
  ${JSON.stringify(e,null,4)}`);let r=$($({},ui),t);function i(o){return r.classicTrim&&!o.trim()||!r.classicTrim&&(r.space&&o===" "||r.cr&&o==="\r"||r.lf&&o===`
40
- `||r.tab&&o===" "||r.nbsp&&o==="\xA0")}let l,n;if(e.length){if(i(e[0]))for(let o=0,a=e.length;o<a;o++){if(!i(e[o])){l=o;break}if(o===e.length-1)return{res:"",ranges:[[0,e.length]]}}if(i(e[e.length-1])){for(let o=e.length;o--;)if(!i(e[o])){n=o+1;break}}return l?n?{res:e.slice(l,n),ranges:[[0,l],[n,e.length]]}:{res:e.slice(l),ranges:[[0,l]]}:n?{res:e.slice(0,n),ranges:[[n,e.length]]}:{res:e,ranges:[]}}return{res:"",ranges:[]}}var gi={heads:["{{"],tails:["}}"]};function Qt(e,t){let r=Object.prototype.hasOwnProperty;if(e===void 0)throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_01] The input is missing!");if(typeof e!="string")return e;if(t&&!(0,Zt.default)(t))throw new Error(`string-remove-duplicate-heads-tails: [THROW_ID_03] The given options are not a plain object but ${typeof t}!`);let i=$({},t);if(i&&r.call(i,"heads"))if(I(i.heads).every(w=>typeof w=="string"||Array.isArray(w)))typeof i.heads=="string"&&(i.heads=I(i.heads));else throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_04] The resolvedOpts.heads contains elements which are not string-type!");if(i&&r.call(i,"tails"))if(I(i.tails).every(w=>typeof w=="string"||Array.isArray(w)))typeof i.tails=="string"&&(i.tails=I(i.tails));else throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_05] The resolvedOpts.tails contains elements which are not string-type!");let l=Q(e).res;if(l.length===0)return e;e=l;let n=$($({},gi),i);n.heads=n.heads.map(w=>w.trim()),n.tails=n.tails.map(w=>w.trim());let o=!1,a=!1,g=new Z({limitToBeAddedWhitespace:!0}),s=new Z({limitToBeAddedWhitespace:!0}),h=!0,c=!0,T="";function y(w,d){let f;return S(w,0,d.heads,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})&&S(w,f,d.tails,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})?w.slice(f):w}for(;e!==y(e,n);)e=Q(y(e,n)).res;function u(w,d){let f;return!k(w,w.length-1,d.tails,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})||!f?w:k(w,f,d.heads,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})?w.slice(0,f+1):w}for(;e!==u(e,n);)e=Q(u(e,n)).res;if(!n.heads.length||!S(e,0,n.heads,{trimBeforeMatching:!0})||!n.tails.length||!k(e,e.length-1,n.tails,{trimBeforeMatching:!0}))return Q(e).res;for(let w=0,d=e.length;w<d;w++)if(e[w].trim()!==""){let f;if(S(e,w,n.heads,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})&&f){c=!0,h&&(h=!0);let p;S(e,f,n.tails,{trimBeforeMatching:!0,cb:(m,b,v)=>(p=v,!0)})&&g.push(w,p),s.current()&&o&&T!=="tails"&&g.push(s.current()),o||s.current()&&(g.push(s.current()),s.wipe()),s.push(w,f),T="heads",w=f-1;continue}if(S(e,w,n.tails,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=Number.isInteger(b)?b:e.length,!0)})&&f){c=!0,h?(T==="heads"&&s.wipe(),h=!1):s.push(w,f),T="tails",w=f-1;continue}h&&(h=!0),c&&!o?(o=!0,c=!1):c&&!a?(a=!0,h=!0,c=!1,T==="heads"&&s.wipe()):c&&a&&s.wipe()}return s.current()&&g.push(s.current()),g.current()?L(e,g.current()).trim():e.trim()}var er="11.1.8";var ci=er,pi=Object.prototype.hasOwnProperty,nr={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function A(e){return typeof e=="string"}function di(e){return typeof e=="number"}function Le(e){return typeof e=="boolean"}function de(e){return e===null}function ee(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function yi(e){return e!=null}function _(e){return A(e)?e.trim():e}function mi(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(0,t)}return e}function wi(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(t+1)}return e}function ir(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(0,t)}return e}function tr(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(t+1)}return e}function qe(e,t){return typeof e!="string"||!e.trim()?!1:!!(e.includes(t.heads)||e.includes(t.tails)||A(t.headsNoWrap)&&t.headsNoWrap.length&&e.includes(t.headsNoWrap)||A(t.tailsNoWrap)&&t.tailsNoWrap.length&&e.includes(t.tailsNoWrap))}function bi(e,t,r){let i,l;return typeof e=="string"&&e.length&&S(e,0,t,{trimBeforeMatching:!0,cb:(n,o,a)=>(i=a,!0)})&&k(e,e.length-1,r,{trimBeforeMatching:!0,cb:(n,o,a)=>(l=(a||0)+1,!0)})?e.slice(i,l):e}function rr(e,t,r=!1,i,l,n){if(t.wrapHeadsWith||(t.wrapHeadsWith=""),t.wrapTailsWith||(t.wrapTailsWith=""),A(e)&&!r&&t.wrapGlobalFlipSwitch&&!t.dontWrapVars.some(o=>ge(n,o))&&(!t.preventDoubleWrapping||t.preventDoubleWrapping&&A(e)&&!e.includes(t.wrapHeadsWith)&&!e.includes(t.wrapTailsWith)))return`${t.wrapHeadsWith}${e}${t.wrapTailsWith}`;if(r){if(!A(e))return e;let o=Qt(e,{heads:t.wrapHeadsWith,tails:t.wrapTailsWith});return A(o)?bi(o,t.wrapHeadsWith,t.wrapTailsWith):o}return e}function Ti(e,t,r,i){let l;if(r.indexOf(".")!==-1){let n=r,o=!0;if(i.lookForDataContainers&&typeof i.dataContainerIdentifierTails=="string"&&i.dataContainerIdentifierTails.length&&!n.endsWith(i.dataContainerIdentifierTails)){let a=W.default.get(e,n+i.dataContainerIdentifierTails);ee(a)&&W.default.get(a,t)&&(l=W.default.get(a,t),o=!1)}for(;o&&n.indexOf(".")!==-1;){if(n=ir(n),tr(n)===t)throw new Error(`json-variables/findValues(): [THROW_ID_20] While trying to resolve: "${t}" at path "${r}", we encountered a closed loop. The parent key "${tr(n)}" is called the same as the variable "${t}" we're looking for.`);if(i.lookForDataContainers&&typeof i.dataContainerIdentifierTails=="string"&&i.dataContainerIdentifierTails.length&&!n.endsWith(i.dataContainerIdentifierTails)){let a=W.default.get(e,n+i.dataContainerIdentifierTails);ee(a)&&W.default.get(a,t)&&(l=W.default.get(a,t),o=!1)}if(l===void 0){let a=W.default.get(e,n);ee(a)&&W.default.get(a,t)&&(l=W.default.get(a,t),o=!1)}}}if(l===void 0){let n=W.default.get(e,t);n!==void 0&&(l=n)}if(l===void 0)if(t.indexOf(".")===-1){let n=Be(e,t);if(n.length){for(let o=0,a=n.length;o<a;o++)if(A(n[o].val)||Le(n[o].val)||de(n[o].val)){l=n[o].val;break}else if(di(n[o].val)){l=String(n[o].val);break}else if(Array.isArray(n[o].val)){l=n[o].val.join("");break}}}else{let n=Be(e,mi(t));if(n.length)for(let o=0,a=n.length;o<a;o++){let g=W.default.get(n[o].val,wi(t));g&&A(g)&&(l=g)}}return l}function ar(e,t,r,i,l=[]){if(l.includes(r)){let y="";if(l.length>1){let u=` \u2192
40
+ `||r.tab&&o===" "||r.nbsp&&o==="\xA0")}let l,n;if(e.length){if(i(e[0]))for(let o=0,a=e.length;o<a;o++){if(!i(e[o])){l=o;break}if(o===e.length-1)return{res:"",ranges:[[0,e.length]]}}if(i(e[e.length-1])){for(let o=e.length;o--;)if(!i(e[o])){n=o+1;break}}return l?n?{res:e.slice(l,n),ranges:[[0,l],[n,e.length]]}:{res:e.slice(l),ranges:[[0,l]]}:n?{res:e.slice(0,n),ranges:[[n,e.length]]}:{res:e,ranges:[]}}return{res:"",ranges:[]}}var gi={heads:["{{"],tails:["}}"]};function Qt(e,t){let r=Object.prototype.hasOwnProperty;if(e===void 0)throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_01] The input is missing!");if(typeof e!="string")return e;if(t&&!(0,Zt.default)(t))throw new Error(`string-remove-duplicate-heads-tails: [THROW_ID_03] The given options are not a plain object but ${typeof t}!`);let i=$({},t);if(i&&r.call(i,"heads"))if(I(i.heads).every(w=>typeof w=="string"||Array.isArray(w)))typeof i.heads=="string"&&(i.heads=I(i.heads));else throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_04] The resolvedOpts.heads contains elements which are not string-type!");if(i&&r.call(i,"tails"))if(I(i.tails).every(w=>typeof w=="string"||Array.isArray(w)))typeof i.tails=="string"&&(i.tails=I(i.tails));else throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_05] The resolvedOpts.tails contains elements which are not string-type!");let l=Q(e).res;if(l.length===0)return e;e=l;let n=$($({},gi),i);n.heads=n.heads.map(w=>w.trim()),n.tails=n.tails.map(w=>w.trim());let o=!1,a=!1,g=new Z({limitToBeAddedWhitespace:!0}),s=new Z({limitToBeAddedWhitespace:!0}),h=!0,c=!0,T="";function y(w,d){let f;return S(w,0,d.heads,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})&&S(w,f,d.tails,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})?w.slice(f):w}for(;e!==y(e,n);)e=Q(y(e,n)).res;function u(w,d){let f;return!k(w,w.length-1,d.tails,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})||!f?w:k(w,f,d.heads,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})?w.slice(0,f+1):w}for(;e!==u(e,n);)e=Q(u(e,n)).res;if(!n.heads.length||!S(e,0,n.heads,{trimBeforeMatching:!0})||!n.tails.length||!k(e,e.length-1,n.tails,{trimBeforeMatching:!0}))return Q(e).res;for(let w=0,d=e.length;w<d;w++)if(e[w].trim()!==""){let f;if(S(e,w,n.heads,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=b,!0)})&&f){c=!0,h&&(h=!0);let p;S(e,f,n.tails,{trimBeforeMatching:!0,cb:(m,b,v)=>(p=v,!0)})&&g.push(w,p),s.current()&&o&&T!=="tails"&&g.push(s.current()),o||s.current()&&(g.push(s.current()),s.wipe()),s.push(w,f),T="heads",w=f-1;continue}if(S(e,w,n.tails,{trimBeforeMatching:!0,cb:(p,m,b)=>(f=Number.isInteger(b)?b:e.length,!0)})&&f){c=!0,h?(T==="heads"&&s.wipe(),h=!1):s.push(w,f),T="tails",w=f-1;continue}h&&(h=!0),c&&!o?(o=!0,c=!1):c&&!a?(a=!0,h=!0,c=!1,T==="heads"&&s.wipe()):c&&a&&s.wipe()}return s.current()&&g.push(s.current()),g.current()?L(e,g.current()).trim():e.trim()}var er="11.1.10";var ci=er,pi=Object.prototype.hasOwnProperty,nr={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function A(e){return typeof e=="string"}function di(e){return typeof e=="number"}function Le(e){return typeof e=="boolean"}function de(e){return e===null}function ee(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function yi(e){return e!=null}function _(e){return A(e)?e.trim():e}function mi(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(0,t)}return e}function wi(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(t+1)}return e}function ir(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(0,t)}return e}function tr(e){if(typeof e=="string"&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(t+1)}return e}function qe(e,t){return typeof e!="string"||!e.trim()?!1:!!(e.includes(t.heads)||e.includes(t.tails)||A(t.headsNoWrap)&&t.headsNoWrap.length&&e.includes(t.headsNoWrap)||A(t.tailsNoWrap)&&t.tailsNoWrap.length&&e.includes(t.tailsNoWrap))}function bi(e,t,r){let i,l;return typeof e=="string"&&e.length&&S(e,0,t,{trimBeforeMatching:!0,cb:(n,o,a)=>(i=a,!0)})&&k(e,e.length-1,r,{trimBeforeMatching:!0,cb:(n,o,a)=>(l=(a||0)+1,!0)})?e.slice(i,l):e}function rr(e,t,r=!1,i,l,n){if(t.wrapHeadsWith||(t.wrapHeadsWith=""),t.wrapTailsWith||(t.wrapTailsWith=""),A(e)&&!r&&t.wrapGlobalFlipSwitch&&!t.dontWrapVars.some(o=>ge(n,o))&&(!t.preventDoubleWrapping||t.preventDoubleWrapping&&A(e)&&!e.includes(t.wrapHeadsWith)&&!e.includes(t.wrapTailsWith)))return`${t.wrapHeadsWith}${e}${t.wrapTailsWith}`;if(r){if(!A(e))return e;let o=Qt(e,{heads:t.wrapHeadsWith,tails:t.wrapTailsWith});return A(o)?bi(o,t.wrapHeadsWith,t.wrapTailsWith):o}return e}function Ti(e,t,r,i){let l;if(r.indexOf(".")!==-1){let n=r,o=!0;if(i.lookForDataContainers&&typeof i.dataContainerIdentifierTails=="string"&&i.dataContainerIdentifierTails.length&&!n.endsWith(i.dataContainerIdentifierTails)){let a=W.default.get(e,n+i.dataContainerIdentifierTails);ee(a)&&W.default.get(a,t)&&(l=W.default.get(a,t),o=!1)}for(;o&&n.indexOf(".")!==-1;){if(n=ir(n),tr(n)===t)throw new Error(`json-variables/findValues(): [THROW_ID_20] While trying to resolve: "${t}" at path "${r}", we encountered a closed loop. The parent key "${tr(n)}" is called the same as the variable "${t}" we're looking for.`);if(i.lookForDataContainers&&typeof i.dataContainerIdentifierTails=="string"&&i.dataContainerIdentifierTails.length&&!n.endsWith(i.dataContainerIdentifierTails)){let a=W.default.get(e,n+i.dataContainerIdentifierTails);ee(a)&&W.default.get(a,t)&&(l=W.default.get(a,t),o=!1)}if(l===void 0){let a=W.default.get(e,n);ee(a)&&W.default.get(a,t)&&(l=W.default.get(a,t),o=!1)}}}if(l===void 0){let n=W.default.get(e,t);n!==void 0&&(l=n)}if(l===void 0)if(t.indexOf(".")===-1){let n=Be(e,t);if(n.length){for(let o=0,a=n.length;o<a;o++)if(A(n[o].val)||Le(n[o].val)||de(n[o].val)){l=n[o].val;break}else if(di(n[o].val)){l=String(n[o].val);break}else if(Array.isArray(n[o].val)){l=n[o].val.join("");break}}}else{let n=Be(e,mi(t));if(n.length)for(let o=0,a=n.length;o<a;o++){let g=W.default.get(n[o].val,wi(t));g&&A(g)&&(l=g)}}return l}function ar(e,t,r,i,l=[]){if(l.includes(r)){let y="";if(l.length>1){let u=` \u2192
41
41
  `;y=l.reduce((w,d,f)=>w+(f===0?"":u)+(d===r?"\u{1F4A5} ":" ")+d,` Here's the path we travelled up until we hit the recursion:
42
42
 
43
43
  `),y+=`${u}\u{1F4A5} ${r}`}throw new Error(`json-variables/resolveString(): [THROW_ID_19] While trying to resolve: "${t}" at path "${r}", we encountered a closed loop, the key is referencing itself."${y}`)}let n={},o=Array.from(l);o.push(r);let a=new Z;function g(y,u,w){for(let d=0,f=y.length;d<f;d++){let p=y[d],m=t.slice(p.headsEndAt,p.tailsStartAt);if(m.length===0)a.push(p.headsStartAt,p.tailsEndAt);else if(pi.call(n,m)&&A(n[m]))a.push(p.headsStartAt,p.tailsEndAt,n[m]);else{let b=Ti(e,m.trim(),r,i);if(b===void 0)if(i.allowUnresolved===!0)b="";else if(typeof i.allowUnresolved=="string")b=i.allowUnresolved;else throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_18] We couldn't find the value to resolve the variable ${t.slice(p.headsEndAt,p.tailsStartAt)}. We're at path: "${r}".`);if(!w&&i.throwWhenNonStringInsertedInString&&!A(b))throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_23] While resolving the variable ${t.slice(p.headsEndAt,p.tailsStartAt)} at path ${r}, it resolved into a non-string value, ${JSON.stringify(b,null,4)}. This is happening because options setting "throwWhenNonStringInsertedInString" is active (set to "true").`);if(Le(b)){if(i.resolveToBoolIfAnyValuesContainBool)return a.wipe(),i.resolveToFalseIfAnyValuesContainBool?!1:b;b=""}else{if(de(b)&&w)return a.wipe(),b;Array.isArray(b)?b=String(b.join("")):de(b)?b="":b=String(b)}let v=r.includes(".")?`${ir(r)}.${m}`:m;if(qe(b,i)){let E=rr(ar(e,b,v,i,o),i,u,o,v,m.trim());typeof E=="string"&&a.push(p.headsStartAt,p.tailsEndAt,E)}else{n[m]=b;let E=rr(b,i,u,o,v,m.trim());typeof E=="string"&&a.push(p.headsStartAt,p.tailsEndAt,E)}}}}let s;try{s=Pe(t,i.heads,i.tails,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(y){throw new Error(`json-variables/resolveString(): [THROW_ID_17] While trying to resolve string: "${t}" at path ${r}, something wrong with heads and tails was detected! Here's the internal error message:
@@ -47,7 +47,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
47
47
  /**
48
48
  * @name arrayiffy-if-string
49
49
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
50
- * @version 4.1.2
50
+ * @version 4.1.4
51
51
  * @author Roy Revelt, Codsen Ltd
52
52
  * @license MIT
53
53
  * {@link https://codsen.com/os/arrayiffy-if-string/}
@@ -55,7 +55,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
55
55
  /**
56
56
  * @name ast-get-values-by-key
57
57
  * @fileoverview Extract values and paths from AST by keys OR set them by keys
58
- * @version 4.1.2
58
+ * @version 4.1.4
59
59
  * @author Roy Revelt, Codsen Ltd
60
60
  * @license MIT
61
61
  * {@link https://codsen.com/os/ast-get-values-by-key/}
@@ -63,7 +63,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
63
63
  /**
64
64
  * @name ast-monkey-traverse
65
65
  * @fileoverview Utility library to traverse AST
66
- * @version 3.1.2
66
+ * @version 3.1.4
67
67
  * @author Roy Revelt, Codsen Ltd
68
68
  * @license MIT
69
69
  * {@link https://codsen.com/os/ast-monkey-traverse/}
@@ -71,7 +71,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
71
71
  /**
72
72
  * @name ast-monkey-util
73
73
  * @fileoverview Utility library of AST helper functions
74
- * @version 2.1.2
74
+ * @version 2.1.4
75
75
  * @author Roy Revelt, Codsen Ltd
76
76
  * @license MIT
77
77
  * {@link https://codsen.com/os/ast-monkey-util/}
@@ -79,7 +79,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
79
79
  /**
80
80
  * @name ranges-apply
81
81
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
82
- * @version 6.2.8
82
+ * @version 6.2.10
83
83
  * @author Roy Revelt, Codsen Ltd
84
84
  * @license MIT
85
85
  * {@link https://codsen.com/os/ranges-apply/}
@@ -87,7 +87,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
87
87
  /**
88
88
  * @name ranges-merge
89
89
  * @fileoverview Merge and sort string index ranges
90
- * @version 8.2.3
90
+ * @version 8.2.5
91
91
  * @author Roy Revelt, Codsen Ltd
92
92
  * @license MIT
93
93
  * {@link https://codsen.com/os/ranges-merge/}
@@ -95,7 +95,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
95
95
  /**
96
96
  * @name ranges-push
97
97
  * @fileoverview Gather string index ranges
98
- * @version 6.2.3
98
+ * @version 6.2.5
99
99
  * @author Roy Revelt, Codsen Ltd
100
100
  * @license MIT
101
101
  * {@link https://codsen.com/os/ranges-push/}
@@ -103,7 +103,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
103
103
  /**
104
104
  * @name ranges-sort
105
105
  * @fileoverview Sort string index ranges
106
- * @version 5.1.2
106
+ * @version 5.1.4
107
107
  * @author Roy Revelt, Codsen Ltd
108
108
  * @license MIT
109
109
  * {@link https://codsen.com/os/ranges-sort/}
@@ -111,7 +111,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
111
111
  /**
112
112
  * @name string-collapse-leading-whitespace
113
113
  * @fileoverview Collapse the leading and trailing whitespace of a string
114
- * @version 6.1.3
114
+ * @version 6.1.5
115
115
  * @author Roy Revelt, Codsen Ltd
116
116
  * @license MIT
117
117
  * {@link https://codsen.com/os/string-collapse-leading-whitespace/}
@@ -119,7 +119,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
119
119
  /**
120
120
  * @name string-find-heads-tails
121
121
  * @fileoverview Finds where are arbitrary templating marker heads and tails located
122
- * @version 5.1.3
122
+ * @version 5.1.5
123
123
  * @author Roy Revelt, Codsen Ltd
124
124
  * @license MIT
125
125
  * {@link https://codsen.com/os/string-find-heads-tails/}
@@ -127,7 +127,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
127
127
  /**
128
128
  * @name string-match-left-right
129
129
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
130
- * @version 8.2.3
130
+ * @version 8.2.5
131
131
  * @author Roy Revelt, Codsen Ltd
132
132
  * @license MIT
133
133
  * {@link https://codsen.com/os/string-match-left-right/}
@@ -135,7 +135,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
135
135
  /**
136
136
  * @name string-remove-duplicate-heads-tails
137
137
  * @fileoverview Detect and (recursively) remove head and tail wrappings around the input string
138
- * @version 6.1.8
138
+ * @version 6.1.10
139
139
  * @author Roy Revelt, Codsen Ltd
140
140
  * @license MIT
141
141
  * {@link https://codsen.com/os/string-remove-duplicate-heads-tails/}
@@ -143,7 +143,7 @@ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(
143
143
  /**
144
144
  * @name string-trim-spaces-only
145
145
  * @fileoverview Like String.trim() but you can choose granularly what to trim
146
- * @version 4.1.2
146
+ * @version 4.1.4
147
147
  * @author Roy Revelt, Codsen Ltd
148
148
  * @license MIT
149
149
  * {@link https://codsen.com/os/string-trim-spaces-only/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-variables",
3
- "version": "11.1.8",
3
+ "version": "11.1.10",
4
4
  "description": "Resolves custom-marked, cross-referenced paths in parsed JSON",
5
5
  "keywords": [
6
6
  "comb",
@@ -48,7 +48,7 @@
48
48
  "examples": "node '../../ops/scripts/run-examples.js'",
49
49
  "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
50
50
  "letspublish": "yarn publish || :",
51
- "lint": "eslint . --fix",
51
+ "lint": "eslint . --ext .js --ext .ts --fix",
52
52
  "perf": "node perf/check.js",
53
53
  "prepare": "echo 'ready'",
54
54
  "prettier": "prettier",
@@ -76,15 +76,15 @@
76
76
  "various": {}
77
77
  },
78
78
  "dependencies": {
79
- "arrayiffy-if-string": "^4.1.2",
80
- "ast-get-values-by-key": "^4.1.2",
81
- "ast-monkey-traverse": "^3.1.2",
79
+ "arrayiffy-if-string": "^4.1.4",
80
+ "ast-get-values-by-key": "^4.1.4",
81
+ "ast-monkey-traverse": "^3.1.4",
82
82
  "matcher": "^5.0.0",
83
83
  "object-path": "^0.11.8",
84
- "ranges-apply": "^6.2.8",
85
- "ranges-push": "^6.2.3",
86
- "string-find-heads-tails": "^5.1.3",
87
- "string-match-left-right": "^8.2.3",
88
- "string-remove-duplicate-heads-tails": "^6.1.8"
84
+ "ranges-apply": "^6.2.10",
85
+ "ranges-push": "^6.2.5",
86
+ "string-find-heads-tails": "^5.1.5",
87
+ "string-match-left-right": "^8.2.5",
88
+ "string-remove-duplicate-heads-tails": "^6.1.10"
89
89
  }
90
90
  }
@@ -1,20 +0,0 @@
1
- // Quick Take
2
-
3
- import { strict as assert } from "assert";
4
-
5
- import { jVar } from "../dist/json-variables.esm.js";
6
-
7
- assert.deepEqual(
8
- jVar({
9
- a: "some text %%_var1.key1.0_%% more text %%_var2.key2.key3.1_%%",
10
- b: "something",
11
- var1: { key1: ["value1"] },
12
- var2: { key2: { key3: ["", "value2"] } },
13
- }),
14
- {
15
- a: "some text value1 more text value2",
16
- b: "something",
17
- var1: { key1: ["value1"] },
18
- var2: { key2: { key3: ["", "value2"] } },
19
- }
20
- );