object-flatten-referencing 7.0.2 → 7.0.4
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
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [7.0.2](https://github.com/codsen/codsen/compare/object-flatten-referencing@7.0.1...object-flatten-referencing@7.0.2) (2022-12-06)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package object-flatten-referencing
|
|
9
|
-
|
|
10
6
|
## 7.0.0 (2022-12-01)
|
|
11
7
|
|
|
12
8
|
### BREAKING CHANGES
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name object-flatten-referencing
|
|
3
3
|
* @fileoverview Flatten complex nested objects according to a reference objects
|
|
4
|
-
* @version 7.0.
|
|
4
|
+
* @version 7.0.4
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/object-flatten-referencing/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import D from"lodash.clonedeep";import{strIndexesOfPlus as A}from"str-indexes-of-plus";import{isMatch as C}from"matcher";import w
|
|
10
|
+
import D from"lodash.clonedeep";import{strIndexesOfPlus as A}from"str-indexes-of-plus";import{isMatch as C}from"matcher";import{isPlainObject as w}from"codsen-utils";import $ from"lodash.clonedeep";import{isPlainObject as I}from"codsen-utils";var j={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function v(f){return typeof f=="string"}function O(f,m){let p={...j,...m};if(arguments.length===0||Object.keys(f).length===0)return[];let i=$(f),r=[];return I(i)&&Object.keys(i).forEach(s=>{I(i[s])&&(i[s]=O(i[s],p)),Array.isArray(i[s])&&(r=r.concat(i[s].map(h=>`${s}${p.objectKeyAndValueJoinChar}${h}`))),v(i[s])&&r.push(`${s}${p.objectKeyAndValueJoinChar}${i[s]}`)}),r}function y(f,m,p=!1,i=!1){let r={...j,...m};if(arguments.length===0||f.length===0)return"";let s=$(f),h="";if(s.length)if(i){for(let e=0,a=s.length;e<a;e++)if(v(s[e])){let l;l="",r.mergeArraysWithLineBreaks&&e>0&&(!r.mergeWithoutTrailingBrIfLineContainsBr||typeof s[e-1]!="string"||r.mergeWithoutTrailingBrIfLineContainsBr&&s[e-1]!==void 0&&!s[e-1].toLowerCase().includes("<br"))&&(l=`<br${r.xhtml?" /":""}>`),h+=`${l}${p?r.wrapHeadsWith:""}${s[e]}${p?r.wrapTailsWith:""}`}else if(Array.isArray(s[e])&&s[e].length&&s[e].every(v)){let l="";r.mergeArraysWithLineBreaks&&h.length&&(l=`<br${r.xhtml?" /":""}>`),h=s[e].reduce((d,t,o,n)=>{let c="";return o!==n.length-1&&(c=" "),d+(o===0?l:"")+(p?r.wrapHeadsWith:"")+t+(p?r.wrapTailsWith:"")+c},h)}}else h=s.reduce((e,a,l,d)=>{let t="";r.mergeArraysWithLineBreaks&&l>0&&(t=`<br${r.xhtml?" /":""}>`);let o="";return l!==d.length-1&&(o=" "),`${e}${l===0?t:""}${p?r.wrapHeadsWith:""}${a}${p?r.wrapTailsWith:""}${o}`},h);return h}function b(f){return v(f)?f.length?[f]:[]:f}var x="7.0.4";var J=x;function W(f){return f!=null}function g(f){return typeof f=="string"}function q(f,m,p){if(arguments.length===0)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_01] all inputs missing!");if(arguments.length===1)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_02] resolvedReference object missing!");if(W(p)&&!w(p))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_03] third resolvedInput, options object must be a plain object. Currently it's: ${typeof p}`);let i={...j,...p};i.dontWrapKeys=b(i.dontWrapKeys),i.preventWrappingIfContains=b(i.preventWrappingIfContains),i.dontWrapPaths=b(i.dontWrapPaths),i.ignore=b(i.ignore),typeof i.whatToDoWhenReferenceIsMissing!="number"&&(i.whatToDoWhenReferenceIsMissing=+i.whatToDoWhenReferenceIsMissing||0);function r(s,h,e,a=!0,l=!0,d=""){let t=D(s),o=D(h);return e.wrapGlobalFlipSwitch||(a=!1),w(t)?Object.keys(t).forEach(n=>{let c=d+(d.length===0?n:`.${n}`);if(e.ignore.length===0||!e.ignore.includes(n)){if(e.wrapGlobalFlipSwitch&&(a=!0,e.dontWrapKeys.length&&(a=a&&!e.dontWrapKeys.some(u=>C(n,u,{caseSensitive:!0}))),e.dontWrapPaths.length&&(a=a&&!e.dontWrapPaths.some(u=>u===c)),e.preventWrappingIfContains.length&&typeof t[n]=="string"&&(a=a&&!e.preventWrappingIfContains.some(u=>t[n].includes(u)))),W(o[n])||!W(o[n])&&e.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(t[n]))if(e.whatToDoWhenReferenceIsMissing===2||g(o[n]))t[n]=y(t[n],e,a,l);else{if(t[n].every(u=>typeof u=="string"||Array.isArray(u))){let u=!0;t[n].forEach(T=>{Array.isArray(T)&&!T.every(g)&&(u=!1)}),u&&(l=!1)}t[n]=r(t[n],o[n],e,a,l,c)}else w(t[n])?e.whatToDoWhenReferenceIsMissing===2||g(o[n])?t[n]=y(O(t[n],e),e,a,l):a?t[n]=r(t[n],o[n],e,a,l,c):t[n]=r(t[n],o[n],{...e,wrapGlobalFlipSwitch:!1},a,l,c):g(t[n])&&(t[n]=r(t[n],o[n],e,a,l,c));else if(typeof t[n]!=typeof o[n]&&e.whatToDoWhenReferenceIsMissing===1)throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ${n} and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing.`)}}):Array.isArray(t)?Array.isArray(o)?t.forEach((n,c)=>{W(t[c])&&W(o[c])?t[c]=r(t[c],o[c],e,a,l,`${d}[${c}]`):t[c]=r(t[c],o[0],e,a,l,`${d}[${c}]`)}):g(o)&&(t=y(t,e,a,l)):g(t)&&t.length&&(e.wrapHeadsWith||e.wrapTailsWith)&&(!e.preventDoubleWrapping||(e.wrapHeadsWith===""||!A(t,e.wrapHeadsWith.trim()).length)&&(e.wrapTailsWith===""||!A(t,e.wrapTailsWith.trim()).length))&&(t=`${a?e.wrapHeadsWith:""}${t}${a?e.wrapTailsWith:""}`),t}return r(f,m,i)}export{b as arrayiffyString,j as defaults,y as flattenArr,O as flattenObject,q as flattenReferencing,J as version};
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name object-flatten-referencing
|
|
3
3
|
* @fileoverview Flatten complex nested objects according to a reference objects
|
|
4
|
-
* @version 7.0.
|
|
4
|
+
* @version 7.0.4
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/object-flatten-referencing/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var objectFlattenReferencing=(()=>{var yt=Object.create;var I=Object.defineProperty,mt=Object.defineProperties,_t=Object.getOwnPropertyDescriptor,wt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols,Ot=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable;var _e=(e,t,r)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t)=>{for(var r in t||(t={}))we.call(t,r)&&_e(e,r,t[r]);if(me)for(var r of me(t))jt.call(t,r)&&_e(e,r,t[r]);return e},ve=(e,t)=>mt(e,wt(t));var Oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xt=(e,t)=>{for(var r in t)I(e,r,{get:t[r],enumerable:!0})},je=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vt(t))!we.call(e,o)&&o!==r&&I(e,o,{get:()=>t[o],enumerable:!(n=_t(t,o))||n.enumerable});return e};var H=(e,t,r)=>(r=e!=null?yt(Ot(e)):{},je(t||!e||!e.__esModule?I(r,"default",{value:e,enumerable:!0}):r,e)),Tt=e=>je(I({},"__esModule",{value:!0}),e);var ce=Oe(($,x)=>{var Wt=200,Me="__lodash_hash_undefined__",De=9007199254740991,re="[object Arguments]",At="[object Array]",He="[object Boolean]",Ke="[object Date]",St="[object Error]",ne="[object Function]",Le="[object GeneratorFunction]",K="[object Map]",Be="[object Number]",ie="[object Object]",xe="[object Promise]",Fe="[object RegExp]",L="[object Set]",Ge="[object String]",Ne="[object Symbol]",Q="[object WeakMap]",Ve="[object ArrayBuffer]",B="[object DataView]",Je="[object Float32Array]",qe="[object Float64Array]",Xe="[object Int8Array]",Ye="[object Int16Array]",Ze="[object Int32Array]",Qe="[object Uint8Array]",ze="[object Uint8ClampedArray]",Ue="[object Uint16Array]",ke="[object Uint32Array]",Ct=/[\\^$.*+?()[\]{}|]/g,It=/\w*$/,$t=/^\[object .+?Constructor\]$/,Et=/^(?:0|[1-9]\d*)$/,h={};h[re]=h[At]=h[Ve]=h[B]=h[He]=h[Ke]=h[Je]=h[qe]=h[Xe]=h[Ye]=h[Ze]=h[K]=h[Be]=h[ie]=h[Fe]=h[L]=h[Ge]=h[Ne]=h[Qe]=h[ze]=h[Ue]=h[ke]=!0;h[St]=h[ne]=h[Q]=!1;var Pt=typeof global=="object"&&global&&global.Object===Object&&global,Rt=typeof self=="object"&&self&&self.Object===Object&&self,m=Pt||Rt||Function("return this")(),et=typeof $=="object"&&$&&!$.nodeType&&$,Te=et&&typeof x=="object"&&x&&!x.nodeType&&x,Mt=Te&&Te.exports===et;function Dt(e,t){return e.set(t[0],t[1]),e}function Ht(e,t){return e.add(t),e}function Kt(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function Lt(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}function tt(e,t,r,n){var o=-1,a=e?e.length:0;for(n&&a&&(r=e[++o]);++o<a;)r=t(r,e[o],o,e);return r}function Bt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Ft(e,t){return e==null?void 0:e[t]}function rt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function We(e){var t=-1,r=Array(e.size);return e.forEach(function(n,o){r[++t]=[o,n]}),r}function oe(e,t){return function(r){return e(t(r))}}function Ae(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Gt=Array.prototype,Nt=Function.prototype,F=Object.prototype,Z=m["__core-js_shared__"],Se=function(){var e=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),nt=Nt.toString,w=F.hasOwnProperty,G=F.toString,Vt=RegExp("^"+nt.call(w).replace(Ct,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ce=Mt?m.Buffer:void 0,Ie=m.Symbol,$e=m.Uint8Array,Jt=oe(Object.getPrototypeOf,Object),qt=Object.create,Xt=F.propertyIsEnumerable,Yt=Gt.splice,Ee=Object.getOwnPropertySymbols,Zt=Ce?Ce.isBuffer:void 0,Qt=oe(Object.keys,Object),z=A(m,"DataView"),E=A(m,"Map"),U=A(m,"Promise"),k=A(m,"Set"),ee=A(m,"WeakMap"),P=A(Object,"create"),zt=j(z),Ut=j(E),kt=j(U),er=j(k),tr=j(ee),Pe=Ie?Ie.prototype:void 0,Re=Pe?Pe.valueOf:void 0;function O(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function rr(){this.__data__=P?P(null):{}}function nr(e){return this.has(e)&&delete this.__data__[e]}function ir(e){var t=this.__data__;if(P){var r=t[e];return r===Me?void 0:r}return w.call(t,e)?t[e]:void 0}function or(e){var t=this.__data__;return P?t[e]!==void 0:w.call(t,e)}function ar(e,t){var r=this.__data__;return r[e]=P&&t===void 0?Me:t,this}O.prototype.clear=rr;O.prototype.delete=nr;O.prototype.get=ir;O.prototype.has=or;O.prototype.set=ar;function _(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function sr(){this.__data__=[]}function fr(e){var t=this.__data__,r=N(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Yt.call(t,r,1),!0}function cr(e){var t=this.__data__,r=N(t,e);return r<0?void 0:t[r][1]}function lr(e){return N(this.__data__,e)>-1}function ur(e,t){var r=this.__data__,n=N(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}_.prototype.clear=sr;_.prototype.delete=fr;_.prototype.get=cr;_.prototype.has=lr;_.prototype.set=ur;function T(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function hr(){this.__data__={hash:new O,map:new(E||_),string:new O}}function pr(e){return V(this,e).delete(e)}function gr(e){return V(this,e).get(e)}function dr(e){return V(this,e).has(e)}function br(e,t){return V(this,e).set(e,t),this}T.prototype.clear=hr;T.prototype.delete=pr;T.prototype.get=gr;T.prototype.has=dr;T.prototype.set=br;function W(e){this.__data__=new _(e)}function yr(){this.__data__=new _}function mr(e){return this.__data__.delete(e)}function _r(e){return this.__data__.get(e)}function wr(e){return this.__data__.has(e)}function vr(e,t){var r=this.__data__;if(r instanceof _){var n=r.__data__;if(!E||n.length<Wt-1)return n.push([e,t]),this;r=this.__data__=new T(n)}return r.set(e,t),this}W.prototype.clear=yr;W.prototype.delete=mr;W.prototype.get=_r;W.prototype.has=wr;W.prototype.set=vr;function Or(e,t){var r=se(e)||qr(e)?Bt(e.length,String):[],n=r.length,o=!!n;for(var a in e)(t||w.call(e,a))&&!(o&&(a=="length"||Gr(a,n)))&&r.push(a);return r}function it(e,t,r){var n=e[t];(!(w.call(e,t)&&ft(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function N(e,t){for(var r=e.length;r--;)if(ft(e[r][0],t))return r;return-1}function jr(e,t){return e&&ot(t,fe(t),e)}function te(e,t,r,n,o,a,u){var i;if(n&&(i=a?n(e,o,a,u):n(e)),i!==void 0)return i;if(!J(e))return e;var c=se(e);if(c){if(i=Lr(e),!t)return Dr(e,i)}else{var l=v(e),d=l==ne||l==Le;if(Yr(e))return Cr(e,t);if(l==ie||l==re||d&&!a){if(rt(e))return a?e:{};if(i=Br(d?{}:e),!t)return Hr(e,jr(i,e))}else{if(!h[l])return a?e:{};i=Fr(e,l,te,t)}}u||(u=new W);var s=u.get(e);if(s)return s;if(u.set(e,i),!c)var p=r?Kr(e):fe(e);return Kt(p||e,function(f,g){p&&(g=f,f=e[g]),it(i,g,te(f,t,r,n,g,e,u))}),i}function xr(e){return J(e)?qt(e):{}}function Tr(e,t,r){var n=t(e);return se(e)?n:Lt(n,r(e))}function Wr(e){return G.call(e)}function Ar(e){if(!J(e)||Vr(e))return!1;var t=lt(e)||rt(e)?Vt:$t;return t.test(j(e))}function Sr(e){if(!st(e))return Qt(e);var t=[];for(var r in Object(e))w.call(e,r)&&r!="constructor"&&t.push(r);return t}function Cr(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function ae(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function Ir(e,t){var r=t?ae(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function $r(e,t,r){var n=t?r(We(e),!0):We(e);return tt(n,Dt,new e.constructor)}function Er(e){var t=new e.constructor(e.source,It.exec(e));return t.lastIndex=e.lastIndex,t}function Pr(e,t,r){var n=t?r(Ae(e),!0):Ae(e);return tt(n,Ht,new e.constructor)}function Rr(e){return Re?Object(Re.call(e)):{}}function Mr(e,t){var r=t?ae(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Dr(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function ot(e,t,r,n){r||(r={});for(var o=-1,a=t.length;++o<a;){var u=t[o],i=n?n(r[u],e[u],u,r,e):void 0;it(r,u,i===void 0?e[u]:i)}return r}function Hr(e,t){return ot(e,at(e),t)}function Kr(e){return Tr(e,fe,at)}function V(e,t){var r=e.__data__;return Nr(t)?r[typeof t=="string"?"string":"hash"]:r.map}function A(e,t){var r=Ft(e,t);return Ar(r)?r:void 0}var at=Ee?oe(Ee,Object):zr,v=Wr;(z&&v(new z(new ArrayBuffer(1)))!=B||E&&v(new E)!=K||U&&v(U.resolve())!=xe||k&&v(new k)!=L||ee&&v(new ee)!=Q)&&(v=function(e){var t=G.call(e),r=t==ie?e.constructor:void 0,n=r?j(r):void 0;if(n)switch(n){case zt:return B;case Ut:return K;case kt:return xe;case er:return L;case tr:return Q}return t});function Lr(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&w.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Br(e){return typeof e.constructor=="function"&&!st(e)?xr(Jt(e)):{}}function Fr(e,t,r,n){var o=e.constructor;switch(t){case Ve:return ae(e);case He:case Ke:return new o(+e);case B:return Ir(e,n);case Je:case qe:case Xe:case Ye:case Ze:case Qe:case ze:case Ue:case ke:return Mr(e,n);case K:return $r(e,n,r);case Be:case Ge:return new o(e);case Fe:return Er(e);case L:return Pr(e,n,r);case Ne:return Rr(e)}}function Gr(e,t){return t=t==null?De:t,!!t&&(typeof e=="number"||Et.test(e))&&e>-1&&e%1==0&&e<t}function Nr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Vr(e){return!!Se&&Se in e}function st(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||F;return e===r}function j(e){if(e!=null){try{return nt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Jr(e){return te(e,!0,!0)}function ft(e,t){return e===t||e!==e&&t!==t}function qr(e){return Xr(e)&&w.call(e,"callee")&&(!Xt.call(e,"callee")||G.call(e)==re)}var se=Array.isArray;function ct(e){return e!=null&&Zr(e.length)&&!lt(e)}function Xr(e){return Qr(e)&&ct(e)}var Yr=Zt||Ur;function lt(e){var t=J(e)?G.call(e):"";return t==ne||t==Le}function Zr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=De}function J(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Qr(e){return!!e&&typeof e=="object"}function fe(e){return ct(e)?Or(e):Sr(e)}function zr(){return[]}function Ur(){return!1}x.exports=Jr});var pe=Oe((On,dt)=>{var tn="[object Object]";function rn(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function nn(e,t){return function(r){return e(t(r))}}var on=Function.prototype,pt=Object.prototype,gt=on.toString,an=pt.hasOwnProperty,sn=gt.call(Object),fn=pt.toString,cn=nn(Object.getPrototypeOf,Object);function ln(e){return!!e&&typeof e=="object"}function un(e){if(!ln(e)||fn.call(e)!=tn||rn(e))return!1;var t=cn(e);if(t===null)return!0;var r=an.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&>.call(r)==sn}dt.exports=un});var dn={};xt(dn,{arrayiffyString:()=>S,defaults:()=>R,flattenArr:()=>M,flattenObject:()=>X,flattenReferencing:()=>gn,version:()=>pn});var be=H(ce(),1);function le(e,t,r=0){if(typeof e!="string")throw new TypeError(`str-indexes-of-plus/strIndexesOfPlus(): first input argument must be a string! Currently it's: ${typeof e}`);if(typeof t!="string")throw new TypeError(`str-indexes-of-plus/strIndexesOfPlus(): second input argument must be a string! Currently it's: ${typeof t}`);if(isNaN(+r)||typeof r=="string"&&!/^\d*$/.test(r))throw new TypeError(`str-indexes-of-plus/strIndexesOfPlus(): third input argument must be a natural number! Currently it's: ${r}`);let n=Array.from(e),o=Array.from(t);if(n.length===0||o.length===0||r!=null&&+r>=n.length)return[];r||(r=0);let a=[],u=!1,i;for(let c=r,l=n.length;c<l;c++)u&&(n[c]===o[c-+i]?c-+i+1===o.length&&a.push(+i):(i=null,u=!1)),u||n[c]===o[0]&&(o.length===1?a.push(c):(u=!0,i=c));return a}function ue(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var he=new Map,ut=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${t}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(r=>{if(typeof r!="string"){if(typeof r>"u")return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof r}' in the array`)}return!0})},kr=(e,t)=>{t=y({caseSensitive:!1},t);let r=e+JSON.stringify(t);if(he.has(r))return he.get(r);let n=e[0]==="!";n&&(e=e.slice(1)),e=ue(e).replace(/\\\*/g,"[\\s\\S]*");let o=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return o.negated=n,he.set(r,o),o},en=(e,t,r,n)=>{if(e=ut(e,"inputs"),t=ut(t,"patterns"),t.length===0)return[];t=t.map(u=>kr(u,r));let{allPatterns:o}=r||{},a=[];for(let u of e){let i,c=[...t].fill(!1);for(let[l,d]of t.entries())if(d.test(u)&&(c[l]=!0,i=!d.negated,!i))break;if(!(i===!1||i===void 0&&t.some(l=>!l.negated)||o&&c.some((l,d)=>!l&&!t[d].negated))&&(a.push(u),n))break}return a};function ht(e,t,r){return en(e,t,r,!0).length>0}var Y=H(pe(),1);var de=H(ce(),1),ge=H(pe(),1);var R={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function q(e){return typeof e=="string"}function X(e,t){let r=y(y({},R),t);if(arguments.length===0||Object.keys(e).length===0)return[];let n=(0,de.default)(e),o=[];return(0,ge.default)(n)&&Object.keys(n).forEach(a=>{(0,ge.default)(n[a])&&(n[a]=X(n[a],r)),Array.isArray(n[a])&&(o=o.concat(n[a].map(u=>`${a}${r.objectKeyAndValueJoinChar}${u}`))),q(n[a])&&o.push(`${a}${r.objectKeyAndValueJoinChar}${n[a]}`)}),o}function M(e,t,r=!1,n=!1){let o=y(y({},R),t);if(arguments.length===0||e.length===0)return"";let a=(0,de.default)(e),u="";if(a.length)if(n){for(let i=0,c=a.length;i<c;i++)if(q(a[i])){let l;l="",o.mergeArraysWithLineBreaks&&i>0&&(!o.mergeWithoutTrailingBrIfLineContainsBr||typeof a[i-1]!="string"||o.mergeWithoutTrailingBrIfLineContainsBr&&a[i-1]!==void 0&&!a[i-1].toLowerCase().includes("<br"))&&(l=`<br${o.xhtml?" /":""}>`),u+=`${l}${r?o.wrapHeadsWith:""}${a[i]}${r?o.wrapTailsWith:""}`}else if(Array.isArray(a[i])&&a[i].length&&a[i].every(q)){let l="";o.mergeArraysWithLineBreaks&&u.length&&(l=`<br${o.xhtml?" /":""}>`),u=a[i].reduce((d,s,p,f)=>{let g="";return p!==f.length-1&&(g=" "),d+(p===0?l:"")+(r?o.wrapHeadsWith:"")+s+(r?o.wrapTailsWith:"")+g},u)}}else u=a.reduce((i,c,l,d)=>{let s="";o.mergeArraysWithLineBreaks&&l>0&&(s=`<br${o.xhtml?" /":""}>`);let p="";return l!==d.length-1&&(p=" "),`${i}${l===0?s:""}${r?o.wrapHeadsWith:""}${c}${r?o.wrapTailsWith:""}${p}`},u);return u}function S(e){return q(e)?e.length?[e]:[]:e}var bt="7.0.2";var pn=bt;function D(e){return e!=null}function C(e){return typeof e=="string"}function gn(e,t,r){if(arguments.length===0)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_01] all inputs missing!");if(arguments.length===1)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_02] resolvedReference object missing!");if(D(r)&&!(0,Y.default)(r))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_03] third resolvedInput, options object must be a plain object. Currently it's: ${typeof r}`);let n=y(y({},R),r);n.dontWrapKeys=S(n.dontWrapKeys),n.preventWrappingIfContains=S(n.preventWrappingIfContains),n.dontWrapPaths=S(n.dontWrapPaths),n.ignore=S(n.ignore),typeof n.whatToDoWhenReferenceIsMissing!="number"&&(n.whatToDoWhenReferenceIsMissing=+n.whatToDoWhenReferenceIsMissing||0);function o(a,u,i,c=!0,l=!0,d=""){let s=(0,be.default)(a),p=(0,be.default)(u);return i.wrapGlobalFlipSwitch||(c=!1),(0,Y.default)(s)?Object.keys(s).forEach(f=>{let g=d+(d.length===0?f:`.${f}`);if(i.ignore.length===0||!i.ignore.includes(f)){if(i.wrapGlobalFlipSwitch&&(c=!0,i.dontWrapKeys.length&&(c=c&&!i.dontWrapKeys.some(b=>ht(f,b,{caseSensitive:!0}))),i.dontWrapPaths.length&&(c=c&&!i.dontWrapPaths.some(b=>b===g)),i.preventWrappingIfContains.length&&typeof s[f]=="string"&&(c=c&&!i.preventWrappingIfContains.some(b=>s[f].includes(b)))),D(p[f])||!D(p[f])&&i.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(s[f]))if(i.whatToDoWhenReferenceIsMissing===2||C(p[f]))s[f]=M(s[f],i,c,l);else{if(s[f].every(b=>typeof b=="string"||Array.isArray(b))){let b=!0;s[f].forEach(ye=>{Array.isArray(ye)&&!ye.every(C)&&(b=!1)}),b&&(l=!1)}s[f]=o(s[f],p[f],i,c,l,g)}else(0,Y.default)(s[f])?i.whatToDoWhenReferenceIsMissing===2||C(p[f])?s[f]=M(X(s[f],i),i,c,l):c?s[f]=o(s[f],p[f],i,c,l,g):s[f]=o(s[f],p[f],ve(y({},i),{wrapGlobalFlipSwitch:!1}),c,l,g):C(s[f])&&(s[f]=o(s[f],p[f],i,c,l,g));else if(typeof s[f]!=typeof p[f]&&i.whatToDoWhenReferenceIsMissing===1)throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ${f} and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing.`)}}):Array.isArray(s)?Array.isArray(p)?s.forEach((f,g)=>{D(s[g])&&D(p[g])?s[g]=o(s[g],p[g],i,c,l,`${d}[${g}]`):s[g]=o(s[g],p[0],i,c,l,`${d}[${g}]`)}):C(p)&&(s=M(s,i,c,l)):C(s)&&s.length&&(i.wrapHeadsWith||i.wrapTailsWith)&&(!i.preventDoubleWrapping||(i.wrapHeadsWith===""||!le(s,i.wrapHeadsWith.trim()).length)&&(i.wrapTailsWith===""||!le(s,i.wrapTailsWith.trim()).length))&&(s=`${c?i.wrapHeadsWith:""}${s}${c?i.wrapTailsWith:""}`),s}return o(e,t,n)}return Tt(dn);})();
|
|
10
|
+
"use strict";var objectFlattenReferencing=(()=>{var ut=Object.create;var $=Object.defineProperty,pt=Object.defineProperties,ht=Object.getOwnPropertyDescriptor,gt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertyNames,de=Object.getOwnPropertySymbols,bt=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable;var be=(e,t,r)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t)=>{for(var r in t||(t={}))ye.call(t,r)&&be(e,r,t[r]);if(de)for(var r of de(t))yt.call(t,r)&&be(e,r,t[r]);return e},me=(e,t)=>pt(e,gt(t));var mt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_t=(e,t)=>{for(var r in t)$(e,r,{get:t[r],enumerable:!0})},_e=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of dt(t))!ye.call(e,a)&&a!==r&&$(e,a,{get:()=>t[a],enumerable:!(n=ht(t,a))||n.enumerable});return e};var we=(e,t,r)=>(r=e!=null?ut(bt(e)):{},_e(t||!e||!e.__esModule?$(r,"default",{value:e,enumerable:!0}):r,e)),wt=e=>_e($({},"__esModule",{value:!0}),e);var fe=mt((E,j)=>{var vt=200,Ee="__lodash_hash_undefined__",Pe=9007199254740991,te="[object Arguments]",xt="[object Array]",De="[object Boolean]",Me="[object Date]",Tt="[object Error]",re="[object Function]",Re="[object GeneratorFunction]",H="[object Map]",Le="[object Number]",ne="[object Object]",ve="[object Promise]",He="[object RegExp]",K="[object Set]",Ke="[object String]",Fe="[object Symbol]",X="[object WeakMap]",Be="[object ArrayBuffer]",F="[object DataView]",Ge="[object Float32Array]",Ne="[object Float64Array]",Ve="[object Int8Array]",Je="[object Int16Array]",Qe="[object Int32Array]",Ue="[object Uint8Array]",qe="[object Uint8ClampedArray]",Xe="[object Uint16Array]",Ye="[object Uint32Array]",Ot=/[\\^$.*+?()[\]{}|]/g,jt=/\w*$/,At=/^\[object .+?Constructor\]$/,Ct=/^(?:0|[1-9]\d*)$/,p={};p[te]=p[xt]=p[Be]=p[F]=p[De]=p[Me]=p[Ge]=p[Ne]=p[Ve]=p[Je]=p[Qe]=p[H]=p[Le]=p[ne]=p[He]=p[K]=p[Ke]=p[Fe]=p[Ue]=p[qe]=p[Xe]=p[Ye]=!0;p[Tt]=p[re]=p[X]=!1;var St=typeof global=="object"&&global&&global.Object===Object&&global,Wt=typeof self=="object"&&self&&self.Object===Object&&self,m=St||Wt||Function("return this")(),Ze=typeof E=="object"&&E&&!E.nodeType&&E,xe=Ze&&typeof j=="object"&&j&&!j.nodeType&&j,It=xe&&xe.exports===Ze;function $t(e,t){return e.set(t[0],t[1]),e}function Et(e,t){return e.add(t),e}function Pt(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function Dt(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}function ze(e,t,r,n){var a=-1,o=e?e.length:0;for(n&&o&&(r=e[++a]);++a<o;)r=t(r,e[a],a,e);return r}function Mt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Rt(e,t){return e==null?void 0:e[t]}function ke(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function Te(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}function ie(e,t){return function(r){return e(t(r))}}function Oe(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Lt=Array.prototype,Ht=Function.prototype,B=Object.prototype,q=m["__core-js_shared__"],je=function(){var e=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),et=Ht.toString,w=B.hasOwnProperty,G=B.toString,Kt=RegExp("^"+et.call(w).replace(Ot,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ae=It?m.Buffer:void 0,Ce=m.Symbol,Se=m.Uint8Array,Ft=ie(Object.getPrototypeOf,Object),Bt=Object.create,Gt=B.propertyIsEnumerable,Nt=Lt.splice,We=Object.getOwnPropertySymbols,Vt=Ae?Ae.isBuffer:void 0,Jt=ie(Object.keys,Object),Y=S(m,"DataView"),P=S(m,"Map"),Z=S(m,"Promise"),z=S(m,"Set"),k=S(m,"WeakMap"),D=S(Object,"create"),Qt=T(Y),Ut=T(P),qt=T(Z),Xt=T(z),Yt=T(k),Ie=Ce?Ce.prototype:void 0,$e=Ie?Ie.valueOf:void 0;function x(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Zt(){this.__data__=D?D(null):{}}function zt(e){return this.has(e)&&delete this.__data__[e]}function kt(e){var t=this.__data__;if(D){var r=t[e];return r===Ee?void 0:r}return w.call(t,e)?t[e]:void 0}function er(e){var t=this.__data__;return D?t[e]!==void 0:w.call(t,e)}function tr(e,t){var r=this.__data__;return r[e]=D&&t===void 0?Ee:t,this}x.prototype.clear=Zt;x.prototype.delete=zt;x.prototype.get=kt;x.prototype.has=er;x.prototype.set=tr;function _(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function rr(){this.__data__=[]}function nr(e){var t=this.__data__,r=N(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Nt.call(t,r,1),!0}function ir(e){var t=this.__data__,r=N(t,e);return r<0?void 0:t[r][1]}function ar(e){return N(this.__data__,e)>-1}function or(e,t){var r=this.__data__,n=N(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}_.prototype.clear=rr;_.prototype.delete=nr;_.prototype.get=ir;_.prototype.has=ar;_.prototype.set=or;function A(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function sr(){this.__data__={hash:new x,map:new(P||_),string:new x}}function fr(e){return V(this,e).delete(e)}function cr(e){return V(this,e).get(e)}function lr(e){return V(this,e).has(e)}function ur(e,t){return V(this,e).set(e,t),this}A.prototype.clear=sr;A.prototype.delete=fr;A.prototype.get=cr;A.prototype.has=lr;A.prototype.set=ur;function C(e){this.__data__=new _(e)}function pr(){this.__data__=new _}function hr(e){return this.__data__.delete(e)}function gr(e){return this.__data__.get(e)}function dr(e){return this.__data__.has(e)}function br(e,t){var r=this.__data__;if(r instanceof _){var n=r.__data__;if(!P||n.length<vt-1)return n.push([e,t]),this;r=this.__data__=new A(n)}return r.set(e,t),this}C.prototype.clear=pr;C.prototype.delete=hr;C.prototype.get=gr;C.prototype.has=dr;C.prototype.set=br;function yr(e,t){var r=oe(e)||Br(e)?Mt(e.length,String):[],n=r.length,a=!!n;for(var o in e)(t||w.call(e,o))&&!(a&&(o=="length"||Lr(o,n)))&&r.push(o);return r}function tt(e,t,r){var n=e[t];(!(w.call(e,t)&&at(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function N(e,t){for(var r=e.length;r--;)if(at(e[r][0],t))return r;return-1}function mr(e,t){return e&&rt(t,se(t),e)}function ee(e,t,r,n,a,o,u){var i;if(n&&(i=o?n(e,a,o,u):n(e)),i!==void 0)return i;if(!J(e))return e;var c=oe(e);if(c){if(i=Dr(e),!t)return $r(e,i)}else{var l=v(e),d=l==re||l==Re;if(Nr(e))return Or(e,t);if(l==ne||l==te||d&&!o){if(ke(e))return o?e:{};if(i=Mr(d?{}:e),!t)return Er(e,mr(i,e))}else{if(!p[l])return o?e:{};i=Rr(e,l,ee,t)}}u||(u=new C);var s=u.get(e);if(s)return s;if(u.set(e,i),!c)var h=r?Pr(e):se(e);return Pt(h||e,function(f,g){h&&(g=f,f=e[g]),tt(i,g,ee(f,t,r,n,g,e,u))}),i}function _r(e){return J(e)?Bt(e):{}}function wr(e,t,r){var n=t(e);return oe(e)?n:Dt(n,r(e))}function vr(e){return G.call(e)}function xr(e){if(!J(e)||Kr(e))return!1;var t=st(e)||ke(e)?Kt:At;return t.test(T(e))}function Tr(e){if(!it(e))return Jt(e);var t=[];for(var r in Object(e))w.call(e,r)&&r!="constructor"&&t.push(r);return t}function Or(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function ae(e){var t=new e.constructor(e.byteLength);return new Se(t).set(new Se(e)),t}function jr(e,t){var r=t?ae(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Ar(e,t,r){var n=t?r(Te(e),!0):Te(e);return ze(n,$t,new e.constructor)}function Cr(e){var t=new e.constructor(e.source,jt.exec(e));return t.lastIndex=e.lastIndex,t}function Sr(e,t,r){var n=t?r(Oe(e),!0):Oe(e);return ze(n,Et,new e.constructor)}function Wr(e){return $e?Object($e.call(e)):{}}function Ir(e,t){var r=t?ae(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function $r(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function rt(e,t,r,n){r||(r={});for(var a=-1,o=t.length;++a<o;){var u=t[a],i=n?n(r[u],e[u],u,r,e):void 0;tt(r,u,i===void 0?e[u]:i)}return r}function Er(e,t){return rt(e,nt(e),t)}function Pr(e){return wr(e,se,nt)}function V(e,t){var r=e.__data__;return Hr(t)?r[typeof t=="string"?"string":"hash"]:r.map}function S(e,t){var r=Rt(e,t);return xr(r)?r:void 0}var nt=We?ie(We,Object):Qr,v=vr;(Y&&v(new Y(new ArrayBuffer(1)))!=F||P&&v(new P)!=H||Z&&v(Z.resolve())!=ve||z&&v(new z)!=K||k&&v(new k)!=X)&&(v=function(e){var t=G.call(e),r=t==ne?e.constructor:void 0,n=r?T(r):void 0;if(n)switch(n){case Qt:return F;case Ut:return H;case qt:return ve;case Xt:return K;case Yt:return X}return t});function Dr(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&w.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Mr(e){return typeof e.constructor=="function"&&!it(e)?_r(Ft(e)):{}}function Rr(e,t,r,n){var a=e.constructor;switch(t){case Be:return ae(e);case De:case Me:return new a(+e);case F:return jr(e,n);case Ge:case Ne:case Ve:case Je:case Qe:case Ue:case qe:case Xe:case Ye:return Ir(e,n);case H:return Ar(e,n,r);case Le:case Ke:return new a(e);case He:return Cr(e);case K:return Sr(e,n,r);case Fe:return Wr(e)}}function Lr(e,t){return t=t==null?Pe:t,!!t&&(typeof e=="number"||Ct.test(e))&&e>-1&&e%1==0&&e<t}function Hr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Kr(e){return!!je&&je in e}function it(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||B;return e===r}function T(e){if(e!=null){try{return et.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Fr(e){return ee(e,!0,!0)}function at(e,t){return e===t||e!==e&&t!==t}function Br(e){return Gr(e)&&w.call(e,"callee")&&(!Gt.call(e,"callee")||G.call(e)==te)}var oe=Array.isArray;function ot(e){return e!=null&&Vr(e.length)&&!st(e)}function Gr(e){return Jr(e)&&ot(e)}var Nr=Vt||Ur;function st(e){var t=J(e)?G.call(e):"";return t==re||t==Re}function Vr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Pe}function J(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Jr(e){return!!e&&typeof e=="object"}function se(e){return ot(e)?yr(e):Tr(e)}function Qr(){return[]}function Ur(){return!1}j.exports=Fr});var kr={};_t(kr,{arrayiffyString:()=>W,defaults:()=>M,flattenArr:()=>R,flattenObject:()=>U,flattenReferencing:()=>zr,version:()=>Zr});var he=we(fe(),1);function ce(e,t,r=0){if(typeof e!="string")throw new TypeError(`str-indexes-of-plus/strIndexesOfPlus(): first input argument must be a string! Currently it's: ${typeof e}`);if(typeof t!="string")throw new TypeError(`str-indexes-of-plus/strIndexesOfPlus(): second input argument must be a string! Currently it's: ${typeof t}`);if(isNaN(+r)||typeof r=="string"&&!/^\d*$/.test(r))throw new TypeError(`str-indexes-of-plus/strIndexesOfPlus(): third input argument must be a natural number! Currently it's: ${r}`);let n=Array.from(e),a=Array.from(t);if(n.length===0||a.length===0||r!=null&&+r>=n.length)return[];r||(r=0);let o=[],u=!1,i;for(let c=r,l=n.length;c<l;c++)u&&(n[c]===a[c-+i]?c-+i+1===a.length&&o.push(+i):(i=null,u=!1)),u||n[c]===a[0]&&(a.length===1?o.push(c):(u=!0,i=c));return o}function le(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var ue=new Map,ft=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${t}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(r=>{if(typeof r!="string"){if(typeof r>"u")return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof r}' in the array`)}return!0})},qr=(e,t)=>{t=y({caseSensitive:!1},t);let r=e+JSON.stringify(t);if(ue.has(r))return ue.get(r);let n=e[0]==="!";n&&(e=e.slice(1)),e=le(e).replace(/\\\*/g,"[\\s\\S]*");let a=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return a.negated=n,ue.set(r,a),a},Xr=(e,t,r,n)=>{if(e=ft(e,"inputs"),t=ft(t,"patterns"),t.length===0)return[];t=t.map(u=>qr(u,r));let{allPatterns:a}=r||{},o=[];for(let u of e){let i,c=[...t].fill(!1);for(let[l,d]of t.entries())if(d.test(u)&&(c[l]=!0,i=!d.negated,!i))break;if(!(i===!1||i===void 0&&t.some(l=>!l.negated)||a&&c.some((l,d)=>!l&&!t[d].negated))&&(o.push(u),n))break}return o};function ct(e,t,r){return Xr(e,t,r,!0).length>0}function O(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}var pe=we(fe(),1);var M={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function Q(e){return typeof e=="string"}function U(e,t){let r=y(y({},M),t);if(arguments.length===0||Object.keys(e).length===0)return[];let n=(0,pe.default)(e),a=[];return O(n)&&Object.keys(n).forEach(o=>{O(n[o])&&(n[o]=U(n[o],r)),Array.isArray(n[o])&&(a=a.concat(n[o].map(u=>`${o}${r.objectKeyAndValueJoinChar}${u}`))),Q(n[o])&&a.push(`${o}${r.objectKeyAndValueJoinChar}${n[o]}`)}),a}function R(e,t,r=!1,n=!1){let a=y(y({},M),t);if(arguments.length===0||e.length===0)return"";let o=(0,pe.default)(e),u="";if(o.length)if(n){for(let i=0,c=o.length;i<c;i++)if(Q(o[i])){let l;l="",a.mergeArraysWithLineBreaks&&i>0&&(!a.mergeWithoutTrailingBrIfLineContainsBr||typeof o[i-1]!="string"||a.mergeWithoutTrailingBrIfLineContainsBr&&o[i-1]!==void 0&&!o[i-1].toLowerCase().includes("<br"))&&(l=`<br${a.xhtml?" /":""}>`),u+=`${l}${r?a.wrapHeadsWith:""}${o[i]}${r?a.wrapTailsWith:""}`}else if(Array.isArray(o[i])&&o[i].length&&o[i].every(Q)){let l="";a.mergeArraysWithLineBreaks&&u.length&&(l=`<br${a.xhtml?" /":""}>`),u=o[i].reduce((d,s,h,f)=>{let g="";return h!==f.length-1&&(g=" "),d+(h===0?l:"")+(r?a.wrapHeadsWith:"")+s+(r?a.wrapTailsWith:"")+g},u)}}else u=o.reduce((i,c,l,d)=>{let s="";a.mergeArraysWithLineBreaks&&l>0&&(s=`<br${a.xhtml?" /":""}>`);let h="";return l!==d.length-1&&(h=" "),`${i}${l===0?s:""}${r?a.wrapHeadsWith:""}${c}${r?a.wrapTailsWith:""}${h}`},u);return u}function W(e){return Q(e)?e.length?[e]:[]:e}var lt="7.0.4";var Zr=lt;function L(e){return e!=null}function I(e){return typeof e=="string"}function zr(e,t,r){if(arguments.length===0)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_01] all inputs missing!");if(arguments.length===1)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_02] resolvedReference object missing!");if(L(r)&&!O(r))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_03] third resolvedInput, options object must be a plain object. Currently it's: ${typeof r}`);let n=y(y({},M),r);n.dontWrapKeys=W(n.dontWrapKeys),n.preventWrappingIfContains=W(n.preventWrappingIfContains),n.dontWrapPaths=W(n.dontWrapPaths),n.ignore=W(n.ignore),typeof n.whatToDoWhenReferenceIsMissing!="number"&&(n.whatToDoWhenReferenceIsMissing=+n.whatToDoWhenReferenceIsMissing||0);function a(o,u,i,c=!0,l=!0,d=""){let s=(0,he.default)(o),h=(0,he.default)(u);return i.wrapGlobalFlipSwitch||(c=!1),O(s)?Object.keys(s).forEach(f=>{let g=d+(d.length===0?f:`.${f}`);if(i.ignore.length===0||!i.ignore.includes(f)){if(i.wrapGlobalFlipSwitch&&(c=!0,i.dontWrapKeys.length&&(c=c&&!i.dontWrapKeys.some(b=>ct(f,b,{caseSensitive:!0}))),i.dontWrapPaths.length&&(c=c&&!i.dontWrapPaths.some(b=>b===g)),i.preventWrappingIfContains.length&&typeof s[f]=="string"&&(c=c&&!i.preventWrappingIfContains.some(b=>s[f].includes(b)))),L(h[f])||!L(h[f])&&i.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(s[f]))if(i.whatToDoWhenReferenceIsMissing===2||I(h[f]))s[f]=R(s[f],i,c,l);else{if(s[f].every(b=>typeof b=="string"||Array.isArray(b))){let b=!0;s[f].forEach(ge=>{Array.isArray(ge)&&!ge.every(I)&&(b=!1)}),b&&(l=!1)}s[f]=a(s[f],h[f],i,c,l,g)}else O(s[f])?i.whatToDoWhenReferenceIsMissing===2||I(h[f])?s[f]=R(U(s[f],i),i,c,l):c?s[f]=a(s[f],h[f],i,c,l,g):s[f]=a(s[f],h[f],me(y({},i),{wrapGlobalFlipSwitch:!1}),c,l,g):I(s[f])&&(s[f]=a(s[f],h[f],i,c,l,g));else if(typeof s[f]!=typeof h[f]&&i.whatToDoWhenReferenceIsMissing===1)throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ${f} and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing.`)}}):Array.isArray(s)?Array.isArray(h)?s.forEach((f,g)=>{L(s[g])&&L(h[g])?s[g]=a(s[g],h[g],i,c,l,`${d}[${g}]`):s[g]=a(s[g],h[0],i,c,l,`${d}[${g}]`)}):I(h)&&(s=R(s,i,c,l)):I(s)&&s.length&&(i.wrapHeadsWith||i.wrapTailsWith)&&(!i.preventDoubleWrapping||(i.wrapHeadsWith===""||!ce(s,i.wrapHeadsWith.trim()).length)&&(i.wrapTailsWith===""||!ce(s,i.wrapTailsWith.trim()).length))&&(s=`${c?i.wrapHeadsWith:""}${s}${c?i.wrapTailsWith:""}`),s}return a(e,t,n)}return wt(kr);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name str-indexes-of-plus
|
|
13
13
|
* @fileoverview Like indexOf but returns array and counts per-grapheme
|
|
14
|
-
* @version 5.0.
|
|
14
|
+
* @version 5.0.3
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/str-indexes-of-plus/}
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* @name codsen-utils
|
|
21
|
+
* @fileoverview Various utility functions
|
|
22
|
+
* @version 1.1.0
|
|
23
|
+
* @author Roy Revelt, Codsen Ltd
|
|
24
|
+
* @license MIT
|
|
25
|
+
* {@link https://codsen.com/os/codsen-utils/}
|
|
26
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "object-flatten-referencing",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.4",
|
|
4
4
|
"description": "Flatten complex nested objects according to a reference objects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"advanced",
|
|
@@ -70,13 +70,12 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
+
"codsen-utils": "^1.1.0",
|
|
73
74
|
"lodash.clonedeep": "^4.5.0",
|
|
74
|
-
"lodash.isplainobject": "^4.0.6",
|
|
75
75
|
"matcher": "^5.0.0",
|
|
76
|
-
"str-indexes-of-plus": "^5.0.
|
|
76
|
+
"str-indexes-of-plus": "^5.0.3"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@types/lodash.clonedeep": "^4.5.7"
|
|
80
|
-
"@types/lodash.isplainobject": "^4.0.7"
|
|
79
|
+
"@types/lodash.clonedeep": "^4.5.7"
|
|
81
80
|
}
|
|
82
81
|
}
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/types/util.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
interface Obj {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
}
|
|
4
|
-
interface Opts {
|
|
5
|
-
wrapHeadsWith: string;
|
|
6
|
-
wrapTailsWith: string;
|
|
7
|
-
dontWrapKeys: string[];
|
|
8
|
-
dontWrapPaths: string[];
|
|
9
|
-
xhtml: boolean;
|
|
10
|
-
preventDoubleWrapping: boolean;
|
|
11
|
-
preventWrappingIfContains: string[];
|
|
12
|
-
objectKeyAndValueJoinChar: string;
|
|
13
|
-
wrapGlobalFlipSwitch: boolean;
|
|
14
|
-
ignore: string[];
|
|
15
|
-
whatToDoWhenReferenceIsMissing: 0 | 1 | 2;
|
|
16
|
-
mergeArraysWithLineBreaks: boolean;
|
|
17
|
-
mergeWithoutTrailingBrIfLineContainsBr: boolean;
|
|
18
|
-
enforceStrictKeyset: boolean;
|
|
19
|
-
}
|
|
20
|
-
declare function flattenObject(objOrig: Obj, opts: Opts): any[];
|
|
21
|
-
declare function flattenArr(
|
|
22
|
-
arrOrig: any[],
|
|
23
|
-
opts: Opts,
|
|
24
|
-
wrap: boolean,
|
|
25
|
-
joinArraysUsingBrs: boolean
|
|
26
|
-
): string;
|
|
27
|
-
declare function arrayiffyString(something: string | any): any;
|
|
28
|
-
export { flattenObject, flattenArr, arrayiffyString, Obj, Opts };
|