object-flatten-referencing 7.0.33 → 7.1.0

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 CHANGED
@@ -1 +1 @@
1
- [{"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/examples/_quickTake.js":"1","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/perf/check.js":"2","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/rollup.config.js":"3","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/src/main.ts":"4","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/src/util.ts":"5","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenArr.js":"6","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenObject.js":"7","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenReferencing.js":"8"},{"size":396,"mtime":1760280945940,"results":"9","hashOfConfig":"10"},{"size":626,"mtime":1760280945940,"results":"11","hashOfConfig":"12"},{"size":373,"mtime":1760280945940,"results":"13","hashOfConfig":"10"},{"size":10686,"mtime":1760280945940,"results":"14","hashOfConfig":"12"},{"size":5629,"mtime":1760280945940,"results":"15","hashOfConfig":"12"},{"size":5996,"mtime":1760280945940,"results":"16","hashOfConfig":"17"},{"size":1202,"mtime":1760280945940,"results":"18","hashOfConfig":"17"},{"size":31778,"mtime":1760280945941,"results":"19","hashOfConfig":"17"},{"filePath":"20","messages":"21","suppressedMessages":"22","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1f1u168",{"filePath":"23","messages":"24","suppressedMessages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"91l1rm",{"filePath":"26","messages":"27","suppressedMessages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","suppressedMessages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","suppressedMessages":"34","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","suppressedMessages":"37","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ns3qdb",{"filePath":"38","messages":"39","suppressedMessages":"40","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"41","messages":"42","suppressedMessages":"43","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/examples/_quickTake.js",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/perf/check.js",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/rollup.config.js",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/src/main.ts",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/src/util.ts",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenArr.js",[],["44","45","46","47","48","49"],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenObject.js",[],["50","51","52","53","54","55"],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenReferencing.js",[],["56","57","58","59","60"],{"ruleId":"61","severity":2,"message":"62","line":3,"column":17,"nodeType":null,"messageId":"63","endLine":3,"endColumn":19,"suppressions":"64"},{"ruleId":"61","severity":2,"message":"65","line":3,"column":21,"nodeType":null,"messageId":"63","endLine":3,"endColumn":23,"suppressions":"66"},{"ruleId":"61","severity":2,"message":"67","line":3,"column":25,"nodeType":null,"messageId":"63","endLine":3,"endColumn":31,"suppressions":"68"},{"ruleId":"61","severity":2,"message":"69","line":3,"column":33,"nodeType":null,"messageId":"63","endLine":3,"endColumn":37,"suppressions":"70"},{"ruleId":"61","severity":2,"message":"71","line":3,"column":39,"nodeType":null,"messageId":"63","endLine":3,"endColumn":42,"suppressions":"72"},{"ruleId":"61","severity":2,"message":"73","line":3,"column":44,"nodeType":null,"messageId":"63","endLine":3,"endColumn":49,"suppressions":"74"},{"ruleId":"61","severity":2,"message":"62","line":3,"column":17,"nodeType":null,"messageId":"63","endLine":3,"endColumn":19,"suppressions":"75"},{"ruleId":"61","severity":2,"message":"65","line":3,"column":21,"nodeType":null,"messageId":"63","endLine":3,"endColumn":23,"suppressions":"76"},{"ruleId":"61","severity":2,"message":"67","line":3,"column":25,"nodeType":null,"messageId":"63","endLine":3,"endColumn":31,"suppressions":"77"},{"ruleId":"61","severity":2,"message":"69","line":3,"column":33,"nodeType":null,"messageId":"63","endLine":3,"endColumn":37,"suppressions":"78"},{"ruleId":"61","severity":2,"message":"71","line":3,"column":39,"nodeType":null,"messageId":"63","endLine":3,"endColumn":42,"suppressions":"79"},{"ruleId":"61","severity":2,"message":"73","line":3,"column":44,"nodeType":null,"messageId":"63","endLine":3,"endColumn":49,"suppressions":"80"},{"ruleId":"61","severity":2,"message":"62","line":3,"column":17,"nodeType":null,"messageId":"63","endLine":3,"endColumn":19,"suppressions":"81"},{"ruleId":"61","severity":2,"message":"65","line":3,"column":21,"nodeType":null,"messageId":"63","endLine":3,"endColumn":23,"suppressions":"82"},{"ruleId":"61","severity":2,"message":"69","line":3,"column":33,"nodeType":null,"messageId":"63","endLine":3,"endColumn":37,"suppressions":"83"},{"ruleId":"61","severity":2,"message":"71","line":3,"column":39,"nodeType":null,"messageId":"63","endLine":3,"endColumn":42,"suppressions":"84"},{"ruleId":"61","severity":2,"message":"73","line":3,"column":44,"nodeType":null,"messageId":"63","endLine":3,"endColumn":49,"suppressions":"85"},"@typescript-eslint/no-unused-vars","'is' is defined but never used.","unusedVar",["86"],"'ok' is defined but never used.",["87"],"'throws' is defined but never used.",["88"],"'type' is defined but never used.",["89"],"'not' is defined but never used.",["90"],"'match' is defined but never used.",["91"],["92"],["93"],["94"],["95"],["96"],["97"],["98"],["99"],["100"],["101"],["102"],{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},"directive",""]
1
+ [{"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/examples/_quickTake.js":"1","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/perf/check.js":"2","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/rollup.config.js":"3","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/src/main.ts":"4","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/src/util.ts":"5","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenArr.js":"6","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenObject.js":"7","/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenReferencing.js":"8"},{"size":396,"mtime":1760566739122,"results":"9","hashOfConfig":"10"},{"size":626,"mtime":1760566739122,"results":"11","hashOfConfig":"12"},{"size":373,"mtime":1760566739122,"results":"13","hashOfConfig":"10"},{"size":10686,"mtime":1760566739122,"results":"14","hashOfConfig":"12"},{"size":5629,"mtime":1760566739122,"results":"15","hashOfConfig":"12"},{"size":5996,"mtime":1760566739122,"results":"16","hashOfConfig":"17"},{"size":1202,"mtime":1760566739123,"results":"18","hashOfConfig":"17"},{"size":31778,"mtime":1760566739123,"results":"19","hashOfConfig":"17"},{"filePath":"20","messages":"21","suppressedMessages":"22","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1nlhngw",{"filePath":"23","messages":"24","suppressedMessages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xjytlu",{"filePath":"26","messages":"27","suppressedMessages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","suppressedMessages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","suppressedMessages":"34","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","suppressedMessages":"37","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"nrihsz",{"filePath":"38","messages":"39","suppressedMessages":"40","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"41","messages":"42","suppressedMessages":"43","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/examples/_quickTake.js",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/perf/check.js",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/rollup.config.js",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/src/main.ts",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/src/util.ts",[],[],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenArr.js",[],["44","45","46","47","48","49"],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenObject.js",[],["50","51","52","53","54","55"],"/home/runner/work/codsen/codsen/packages/object-flatten-referencing/test/flattenReferencing.js",[],["56","57","58","59","60"],{"ruleId":"61","severity":2,"message":"62","line":3,"column":17,"nodeType":null,"messageId":"63","endLine":3,"endColumn":19,"suppressions":"64"},{"ruleId":"61","severity":2,"message":"65","line":3,"column":21,"nodeType":null,"messageId":"63","endLine":3,"endColumn":23,"suppressions":"66"},{"ruleId":"61","severity":2,"message":"67","line":3,"column":25,"nodeType":null,"messageId":"63","endLine":3,"endColumn":31,"suppressions":"68"},{"ruleId":"61","severity":2,"message":"69","line":3,"column":33,"nodeType":null,"messageId":"63","endLine":3,"endColumn":37,"suppressions":"70"},{"ruleId":"61","severity":2,"message":"71","line":3,"column":39,"nodeType":null,"messageId":"63","endLine":3,"endColumn":42,"suppressions":"72"},{"ruleId":"61","severity":2,"message":"73","line":3,"column":44,"nodeType":null,"messageId":"63","endLine":3,"endColumn":49,"suppressions":"74"},{"ruleId":"61","severity":2,"message":"62","line":3,"column":17,"nodeType":null,"messageId":"63","endLine":3,"endColumn":19,"suppressions":"75"},{"ruleId":"61","severity":2,"message":"65","line":3,"column":21,"nodeType":null,"messageId":"63","endLine":3,"endColumn":23,"suppressions":"76"},{"ruleId":"61","severity":2,"message":"67","line":3,"column":25,"nodeType":null,"messageId":"63","endLine":3,"endColumn":31,"suppressions":"77"},{"ruleId":"61","severity":2,"message":"69","line":3,"column":33,"nodeType":null,"messageId":"63","endLine":3,"endColumn":37,"suppressions":"78"},{"ruleId":"61","severity":2,"message":"71","line":3,"column":39,"nodeType":null,"messageId":"63","endLine":3,"endColumn":42,"suppressions":"79"},{"ruleId":"61","severity":2,"message":"73","line":3,"column":44,"nodeType":null,"messageId":"63","endLine":3,"endColumn":49,"suppressions":"80"},{"ruleId":"61","severity":2,"message":"62","line":3,"column":17,"nodeType":null,"messageId":"63","endLine":3,"endColumn":19,"suppressions":"81"},{"ruleId":"61","severity":2,"message":"65","line":3,"column":21,"nodeType":null,"messageId":"63","endLine":3,"endColumn":23,"suppressions":"82"},{"ruleId":"61","severity":2,"message":"69","line":3,"column":33,"nodeType":null,"messageId":"63","endLine":3,"endColumn":37,"suppressions":"83"},{"ruleId":"61","severity":2,"message":"71","line":3,"column":39,"nodeType":null,"messageId":"63","endLine":3,"endColumn":42,"suppressions":"84"},{"ruleId":"61","severity":2,"message":"73","line":3,"column":44,"nodeType":null,"messageId":"63","endLine":3,"endColumn":49,"suppressions":"85"},"@typescript-eslint/no-unused-vars","'is' is defined but never used.","unusedVar",["86"],"'ok' is defined but never used.",["87"],"'throws' is defined but never used.",["88"],"'type' is defined but never used.",["89"],"'not' is defined but never used.",["90"],"'match' is defined but never used.",["91"],["92"],["93"],["94"],["95"],["96"],["97"],["98"],["99"],["100"],["101"],["102"],{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},{"kind":"103","justification":"104"},"directive",""]
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
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.1.0 (2025-10-15)
7
+
8
+ ### Features
9
+
10
+ - if value to be added is a number, keep it as is, don't stringify ([ce3e1a5](https://github.com/codsen/codsen/commit/ce3e1a525998ca3c0abf0142affef95b14cd1990))
11
+
6
12
  ## 7.0.0 (2022-12-01)
7
13
 
8
14
  ### BREAKING CHANGES
package/README.md CHANGED
@@ -56,7 +56,7 @@ assert.deepEqual(
56
56
 
57
57
  ## Documentation
58
58
 
59
- Please [visit codsen.com](https://codsen.com/os/object-flatten-referencing/) for a full description of the API.
59
+ Please [visit codsen.com](https://codsen.com/os/object-flatten-referencing/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/object-flatten-referencing/CHANGELOG.md).
60
60
 
61
61
  ## Contributing
62
62
 
@@ -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.33
4
+ * @version 7.1.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/object-flatten-referencing/}
8
8
  */
9
9
 
10
- import C from"rfdc";import{strIndexesOfPlus as S}from"str-indexes-of-plus";import{isMatch as P}from"matcher";import{arrayiffy as y}from"arrayiffy-if-string";import{existy as O,isStr as m,isPlainObject as b}from"codsen-utils";import A from"rfdc";import{isStr as w,isPlainObject as I}from"codsen-utils";var T=A(),W={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function j(g,u){let c={...W,...u};if(arguments.length===0||Object.keys(g).length===0)return[];let i=T(g),n=[];return I(i)&&Object.keys(i).forEach(a=>{I(i[a])&&(i[a]=j(i[a],c)),Array.isArray(i[a])&&(n=n.concat(i[a].map(p=>`${a}${c.objectKeyAndValueJoinChar}${p}`))),w(i[a])&&n.push(`${a}${c.objectKeyAndValueJoinChar}${i[a]}`)}),n}function v(g,u,c=!1,i=!1){let n={...W,...u};if(arguments.length===0||g.length===0)return"";let a=T(g),p="";if(a.length)if(i){for(let e=0,s=a.length;e<s;e++)if(w(a[e])){let l;l="",n.mergeArraysWithLineBreaks&&e>0&&(!n.mergeWithoutTrailingBrIfLineContainsBr||typeof a[e-1]!="string"||n.mergeWithoutTrailingBrIfLineContainsBr&&a[e-1]!==void 0&&!a[e-1].toLowerCase().includes("<br"))&&(l=`<br${n.xhtml?" /":""}>`),p+=`${l}${c?n.wrapHeadsWith:""}${a[e]}${c?n.wrapTailsWith:""}`}else if(Array.isArray(a[e])&&a[e].length&&a[e].every(w)){let l="";n.mergeArraysWithLineBreaks&&p.length&&(l=`<br${n.xhtml?" /":""}>`),p=a[e].reduce((d,t,o,r)=>{let f="";return o!==r.length-1&&(f=" "),d+(o===0?l:"")+(c?n.wrapHeadsWith:"")+t+(c?n.wrapTailsWith:"")+f},p)}}else p=a.reduce((e,s,l,d)=>{let t="";n.mergeArraysWithLineBreaks&&l>0&&(t=`<br${n.xhtml?" /":""}>`);let o="";return l!==d.length-1&&(o=" "),`${e}${l===0?t:""}${c?n.wrapHeadsWith:""}${s}${c?n.wrapTailsWith:""}${o}`},p);return p}var x="7.0.33";var D=C(),Q=x;function X(g,u,c){if(!b(g))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_01] the first input argument must be a plain object! It was given as ${JSON.stringify(g,null,4)} (its typeof was ${typeof g}).`);if(!b(u))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_02] the second input argument must be a plain object! It was given as ${JSON.stringify(u,null,4)} (its typeof was ${typeof u}).`);if(c&&!b(c))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_03] the third input argument must be a plain object! It was given as ${JSON.stringify(c,null,4)} (its typeof was ${typeof c}).`);let i={...W,...c};i.dontWrapKeys=y(i.dontWrapKeys),i.preventWrappingIfContains=y(i.preventWrappingIfContains),i.dontWrapPaths=y(i.dontWrapPaths),i.ignore=y(i.ignore),typeof i.whatToDoWhenReferenceIsMissing!="number"&&(i.whatToDoWhenReferenceIsMissing=+i.whatToDoWhenReferenceIsMissing||0);function n(a,p,e,s=!0,l=!0,d=""){let t=D(a),o=D(p);return e.wrapGlobalFlipSwitch||(s=!1),b(t)?Object.keys(t).forEach(r=>{let f=d+(d.length===0?r:`.${r}`);if(e.ignore.length===0||!e.ignore.includes(r)){if(e.wrapGlobalFlipSwitch&&(s=!0,e.dontWrapKeys.length&&(s=s&&!e.dontWrapKeys.some(h=>P(r,h,{caseSensitive:!0}))),e.dontWrapPaths.length&&(s=s&&!e.dontWrapPaths.some(h=>h===f)),e.preventWrappingIfContains.length&&typeof t[r]=="string"&&(s=s&&!e.preventWrappingIfContains.some(h=>t[r].includes(h)))),O(o[r])||!O(o[r])&&e.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(t[r]))if(e.whatToDoWhenReferenceIsMissing===2||m(o[r]))t[r]=v(t[r],e,s,l);else{if(t[r].every(h=>typeof h=="string"||Array.isArray(h))){let h=!0;t[r].forEach($=>{Array.isArray($)&&!$.every(m)&&(h=!1)}),h&&(l=!1)}t[r]=n(t[r],o[r],e,s,l,f)}else b(t[r])?e.whatToDoWhenReferenceIsMissing===2||m(o[r])?t[r]=v(j(t[r],e),e,s,l):s?t[r]=n(t[r],o[r],e,s,l,f):t[r]=n(t[r],o[r],{...e,wrapGlobalFlipSwitch:!1},s,l,f):m(t[r])&&(t[r]=n(t[r],o[r],e,s,l,f));else if(typeof t[r]!=typeof o[r]&&e.whatToDoWhenReferenceIsMissing===1)throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ${r} and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing.`)}}):Array.isArray(t)?Array.isArray(o)?t.forEach((r,f)=>{O(t[f])&&O(o[f])?t[f]=n(t[f],o[f],e,s,l,`${d}[${f}]`):t[f]=n(t[f],o[0],e,s,l,`${d}[${f}]`)}):m(o)&&(t=v(t,e,s,l)):m(t)&&t.length&&(e.wrapHeadsWith||e.wrapTailsWith)&&(!e.preventDoubleWrapping||(e.wrapHeadsWith===""||!S(t,e.wrapHeadsWith.trim()).length)&&(e.wrapTailsWith===""||!S(t,e.wrapTailsWith.trim()).length))&&(t=`${s?e.wrapHeadsWith:""}${t}${s?e.wrapTailsWith:""}`),t}return n(g,u,i)}export{y as arrayiffy,W as defaults,v as flattenArr,j as flattenObject,X as flattenReferencing,Q as version};
10
+ import C from"rfdc";import{strIndexesOfPlus as S}from"str-indexes-of-plus";import{isMatch as P}from"matcher";import{arrayiffy as y}from"arrayiffy-if-string";import{existy as O,isStr as m,isPlainObject as b}from"codsen-utils";import A from"rfdc";import{isStr as w,isPlainObject as I}from"codsen-utils";var T=A(),W={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function j(g,u){let c={...W,...u};if(arguments.length===0||Object.keys(g).length===0)return[];let i=T(g),n=[];return I(i)&&Object.keys(i).forEach(a=>{I(i[a])&&(i[a]=j(i[a],c)),Array.isArray(i[a])&&(n=n.concat(i[a].map(p=>`${a}${c.objectKeyAndValueJoinChar}${p}`))),w(i[a])&&n.push(`${a}${c.objectKeyAndValueJoinChar}${i[a]}`)}),n}function v(g,u,c=!1,i=!1){let n={...W,...u};if(arguments.length===0||g.length===0)return"";let a=T(g),p="";if(a.length)if(i){for(let e=0,s=a.length;e<s;e++)if(w(a[e])){let l;l="",n.mergeArraysWithLineBreaks&&e>0&&(!n.mergeWithoutTrailingBrIfLineContainsBr||typeof a[e-1]!="string"||n.mergeWithoutTrailingBrIfLineContainsBr&&a[e-1]!==void 0&&!a[e-1].toLowerCase().includes("<br"))&&(l=`<br${n.xhtml?" /":""}>`),p+=`${l}${c?n.wrapHeadsWith:""}${a[e]}${c?n.wrapTailsWith:""}`}else if(Array.isArray(a[e])&&a[e].length&&a[e].every(w)){let l="";n.mergeArraysWithLineBreaks&&p.length&&(l=`<br${n.xhtml?" /":""}>`),p=a[e].reduce((d,t,o,r)=>{let f="";return o!==r.length-1&&(f=" "),d+(o===0?l:"")+(c?n.wrapHeadsWith:"")+t+(c?n.wrapTailsWith:"")+f},p)}}else p=a.reduce((e,s,l,d)=>{let t="";n.mergeArraysWithLineBreaks&&l>0&&(t=`<br${n.xhtml?" /":""}>`);let o="";return l!==d.length-1&&(o=" "),`${e}${l===0?t:""}${c?n.wrapHeadsWith:""}${s}${c?n.wrapTailsWith:""}${o}`},p);return p}var x="7.1.0";var D=C(),Q=x;function X(g,u,c){if(!b(g))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_01] the first input argument must be a plain object! It was given as ${JSON.stringify(g,null,4)} (its typeof was ${typeof g}).`);if(!b(u))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_02] the second input argument must be a plain object! It was given as ${JSON.stringify(u,null,4)} (its typeof was ${typeof u}).`);if(c&&!b(c))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_03] the third input argument must be a plain object! It was given as ${JSON.stringify(c,null,4)} (its typeof was ${typeof c}).`);let i={...W,...c};i.dontWrapKeys=y(i.dontWrapKeys),i.preventWrappingIfContains=y(i.preventWrappingIfContains),i.dontWrapPaths=y(i.dontWrapPaths),i.ignore=y(i.ignore),typeof i.whatToDoWhenReferenceIsMissing!="number"&&(i.whatToDoWhenReferenceIsMissing=+i.whatToDoWhenReferenceIsMissing||0);function n(a,p,e,s=!0,l=!0,d=""){let t=D(a),o=D(p);return e.wrapGlobalFlipSwitch||(s=!1),b(t)?Object.keys(t).forEach(r=>{let f=d+(d.length===0?r:`.${r}`);if(e.ignore.length===0||!e.ignore.includes(r)){if(e.wrapGlobalFlipSwitch&&(s=!0,e.dontWrapKeys.length&&(s=s&&!e.dontWrapKeys.some(h=>P(r,h,{caseSensitive:!0}))),e.dontWrapPaths.length&&(s=s&&!e.dontWrapPaths.some(h=>h===f)),e.preventWrappingIfContains.length&&typeof t[r]=="string"&&(s=s&&!e.preventWrappingIfContains.some(h=>t[r].includes(h)))),O(o[r])||!O(o[r])&&e.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(t[r]))if(e.whatToDoWhenReferenceIsMissing===2||m(o[r]))t[r]=v(t[r],e,s,l);else{if(t[r].every(h=>typeof h=="string"||Array.isArray(h))){let h=!0;t[r].forEach($=>{Array.isArray($)&&!$.every(m)&&(h=!1)}),h&&(l=!1)}t[r]=n(t[r],o[r],e,s,l,f)}else b(t[r])?e.whatToDoWhenReferenceIsMissing===2||m(o[r])?t[r]=v(j(t[r],e),e,s,l):s?t[r]=n(t[r],o[r],e,s,l,f):t[r]=n(t[r],o[r],{...e,wrapGlobalFlipSwitch:!1},s,l,f):m(t[r])&&(t[r]=n(t[r],o[r],e,s,l,f));else if(typeof t[r]!=typeof o[r]&&e.whatToDoWhenReferenceIsMissing===1)throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ${r} and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing.`)}}):Array.isArray(t)?Array.isArray(o)?t.forEach((r,f)=>{O(t[f])&&O(o[f])?t[f]=n(t[f],o[f],e,s,l,`${d}[${f}]`):t[f]=n(t[f],o[0],e,s,l,`${d}[${f}]`)}):m(o)&&(t=v(t,e,s,l)):m(t)&&t.length&&(e.wrapHeadsWith||e.wrapTailsWith)&&(!e.preventDoubleWrapping||(e.wrapHeadsWith===""||!S(t,e.wrapHeadsWith.trim()).length)&&(e.wrapTailsWith===""||!S(t,e.wrapTailsWith.trim()).length))&&(t=`${s?e.wrapHeadsWith:""}${t}${s?e.wrapTailsWith:""}`),t}return n(g,u,i)}export{y as arrayiffy,W as defaults,v as flattenArr,j as flattenObject,X as flattenReferencing,Q as version};
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * @name object-flatten-referencing
3
3
  * @fileoverview Flatten complex nested objects according to a reference objects
4
- * @version 7.0.33
4
+ * @version 7.1.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/object-flatten-referencing/}
8
8
  */
9
9
 
10
- "use strict";var objectFlattenReferencing=(()=>{var X=Object.create,P=Object.freeze,A=Object.defineProperty,Y=Object.defineProperties,U=Object.getOwnPropertyDescriptor,ee=Object.getOwnPropertyDescriptors,re=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,te=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var _=(e,n,s)=>n in e?A(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s,b=(e,n)=>{for(var s in n||(n={}))R.call(n,s)&&_(e,s,n[s]);if(B)for(var s of B(n))ne.call(n,s)&&_(e,s,n[s]);return e},M=(e,n)=>Y(e,ee(n));var ie=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),se=(e,n)=>{for(var s in n)A(e,s,{get:n[s],enumerable:!0})},L=(e,n,s,f)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of re(n))!R.call(e,o)&&o!==s&&A(e,o,{get:()=>n[o],enumerable:!(f=U(n,o))||f.enumerable});return e};var C=(e,n,s)=>(s=e!=null?X(te(e)):{},L(n||!e||!e.__esModule?A(s,"default",{value:e,enumerable:!0}):s,e)),ae=e=>L(A({},"__esModule",{value:!0}),e);var W=(e,n)=>P(A(e,"raw",{value:P(n||e.slice())}));var v=ie((be,H)=>{"use strict";H.exports=oe;function w(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function oe(e){if(e=e||{},e.circles)return le(e);let n=new Map;if(n.set(Date,l=>new Date(l)),n.set(Map,(l,t)=>new Map(f(Array.from(l),t))),n.set(Set,(l,t)=>new Set(f(Array.from(l),t))),e.constructorHandlers)for(let l of e.constructorHandlers)n.set(l[0],l[1]);let s=null;return e.proto?c:o;function f(l,t){let r=Object.keys(l),a=new Array(r.length);for(let g=0;g<r.length;g++){let i=r[g],p=l[i];typeof p!="object"||p===null?a[i]=p:p.constructor!==Object&&(s=n.get(p.constructor))?a[i]=s(p,t):ArrayBuffer.isView(p)?a[i]=w(p):a[i]=t(p)}return a}function o(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return f(l,o);if(l.constructor!==Object&&(s=n.get(l.constructor)))return s(l,o);let t={};for(let r in l){if(Object.hasOwnProperty.call(l,r)===!1)continue;let a=l[r];typeof a!="object"||a===null?t[r]=a:a.constructor!==Object&&(s=n.get(a.constructor))?t[r]=s(a,o):ArrayBuffer.isView(a)?t[r]=w(a):t[r]=o(a)}return t}function c(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return f(l,c);if(l.constructor!==Object&&(s=n.get(l.constructor)))return s(l,c);let t={};for(let r in l){let a=l[r];typeof a!="object"||a===null?t[r]=a:a.constructor!==Object&&(s=n.get(a.constructor))?t[r]=s(a,c):ArrayBuffer.isView(a)?t[r]=w(a):t[r]=c(a)}return t}}function le(e){let n=[],s=[],f=new Map;if(f.set(Date,r=>new Date(r)),f.set(Map,(r,a)=>new Map(c(Array.from(r),a))),f.set(Set,(r,a)=>new Set(c(Array.from(r),a))),e.constructorHandlers)for(let r of e.constructorHandlers)f.set(r[0],r[1]);let o=null;return e.proto?t:l;function c(r,a){let g=Object.keys(r),i=new Array(g.length);for(let p=0;p<g.length;p++){let u=g[p],h=r[u];if(typeof h!="object"||h===null)i[u]=h;else if(h.constructor!==Object&&(o=f.get(h.constructor)))i[u]=o(h,a);else if(ArrayBuffer.isView(h))i[u]=w(h);else{let d=n.indexOf(h);d!==-1?i[u]=s[d]:i[u]=a(h)}}return i}function l(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return c(r,l);if(r.constructor!==Object&&(o=f.get(r.constructor)))return o(r,l);let a={};n.push(r),s.push(a);for(let g in r){if(Object.hasOwnProperty.call(r,g)===!1)continue;let i=r[g];if(typeof i!="object"||i===null)a[g]=i;else if(i.constructor!==Object&&(o=f.get(i.constructor)))a[g]=o(i,l);else if(ArrayBuffer.isView(i))a[g]=w(i);else{let p=n.indexOf(i);p!==-1?a[g]=s[p]:a[g]=l(i)}}return n.pop(),s.pop(),a}function t(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return c(r,t);if(r.constructor!==Object&&(o=f.get(r.constructor)))return o(r,t);let a={};n.push(r),s.push(a);for(let g in r){let i=r[g];if(typeof i!="object"||i===null)a[g]=i;else if(i.constructor!==Object&&(o=f.get(i.constructor)))a[g]=o(i,t);else if(ArrayBuffer.isView(i))a[g]=w(i);else{let p=n.indexOf(i);p!==-1?a[g]=s[p]:a[g]=t(i)}}return n.pop(),s.pop(),a}}});var he={};se(he,{arrayiffy:()=>O,defaults:()=>x,flattenArr:()=>S,flattenObject:()=>$,flattenReferencing:()=>ge,version:()=>pe});var Z=C(v(),1);function T(e,n,s=0){if(typeof e!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): first input argument must be a string! Currently it's: ".concat(typeof e));if(typeof n!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): second input argument must be a string! Currently it's: ".concat(typeof n));if(isNaN(+s)||typeof s=="string"&&!/^\d*$/.test(s))throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): third input argument must be a natural number! Currently it's: ".concat(s));let f=Array.from(e),o=Array.from(n);if(f.length===0||o.length===0||s!=null&&+s>=f.length)return[];s||(s=0);let c=[],l=!1,t;for(let r=s,a=f.length;r<a;r++)l&&(f[r]===o[r-+t]?r-+t+1===o.length&&c.push(+t):(t=null,l=!1)),l||f[r]===o[0]&&(o.length===1?c.push(r):(l=!0,t=r));return c}function D(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var I=new Map,N=(e,n)=>{if(!Array.isArray(e))switch(typeof e){case"string":{e=[e];break}case"undefined":{e=[];break}default:throw new TypeError("Expected '".concat(n,"' to be a string or an array, but got a type of '").concat(typeof e,"'"))}return e.filter(s=>{if(typeof s!="string"){if(s===void 0)return!1;throw new TypeError("Expected '".concat(n,"' to be an array of strings, but found a type of '").concat(typeof s,"' in the array"))}return!0})},K,F,J,fe=(e,n)=>{n=b({caseSensitive:!1},n);let s="s"+(n.caseSensitive?"":"i"),f=e+"|"+s;if(I.has(f))return I.get(f);let o=e[0]==="!";o&&(e=e.slice(1)),e=e.replaceAll(String.raw(K||(K=W(["*"],["\\*"]))),"__ESCAPED_STAR__").replaceAll("\\\\","__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g,"$1"),e=D(e).replaceAll(String.raw(F||(F=W(["*"],["\\*"]))),".*"),e=e.replaceAll("__ESCAPED_STAR__",String.raw(J||(J=W(["*"],["\\*"])))).replaceAll("__ESCAPED_BACKSLASH__","\\\\");let c=new RegExp("^".concat(e,"$"),s);return c.negated=o,I.set(f,c),c},ce=(e,n,s,f)=>{if(e=N(e,"inputs"),n=N(n,"patterns"),n.length===0)return[];n=n.map(r=>fe(r,s));let o=n.filter(r=>r.negated),c=n.filter(r=>!r.negated),{allPatterns:l}=s||{},t=[];if(l&&f&&o.length>1&&c.length===0){for(let r of e)for(let a of o)if(a.test(r))return[];return e.slice(0,1)}for(let r of e){let a=!1;for(let g of o)if(g.test(r)){a=!0;break}if(!a){if(c.length===0)t.push(r);else if(l){let g=Array.from({length:c.length},()=>!1);for(let[i,p]of c.entries())p.test(r)&&(g[i]=!0);g.every(Boolean)&&t.push(r)}else{let g=!1;for(let i of c)if(i.test(r)){g=!0;break}g&&t.push(r)}if(f&&t.length>0)break}}return t};function V(e,n,s){return ce(e,n,s,!0).length>0}function O(e){return typeof e!="string"?e:e.length?[e]:[]}var G=C(v(),1);var xe=(0,G.default)();function y(e){if(e==null||typeof e!="object")return!1;let n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&Object.getPrototypeOf(n)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function m(e){return typeof e=="string"}function j(e){return e!=null}var Q=C(v(),1);var k=(0,Q.default)(),x={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function $(e,n){let s=b(b({},x),n);if(arguments.length===0||Object.keys(e).length===0)return[];let f=k(e),o=[];return y(f)&&Object.keys(f).forEach(c=>{y(f[c])&&(f[c]=$(f[c],s)),Array.isArray(f[c])&&(o=o.concat(f[c].map(l=>"".concat(c).concat(s.objectKeyAndValueJoinChar).concat(l)))),m(f[c])&&o.push("".concat(c).concat(s.objectKeyAndValueJoinChar).concat(f[c]))}),o}function S(e,n,s=!1,f=!1){let o=b(b({},x),n);if(arguments.length===0||e.length===0)return"";let c=k(e),l="";if(c.length)if(f){for(let t=0,r=c.length;t<r;t++)if(m(c[t])){let a;a="",o.mergeArraysWithLineBreaks&&t>0&&(!o.mergeWithoutTrailingBrIfLineContainsBr||typeof c[t-1]!="string"||o.mergeWithoutTrailingBrIfLineContainsBr&&c[t-1]!==void 0&&!c[t-1].toLowerCase().includes("<br"))&&(a="<br".concat(o.xhtml?" /":"",">")),l+="".concat(a).concat(s?o.wrapHeadsWith:"").concat(c[t]).concat(s?o.wrapTailsWith:"")}else if(Array.isArray(c[t])&&c[t].length&&c[t].every(m)){let a="";o.mergeArraysWithLineBreaks&&l.length&&(a="<br".concat(o.xhtml?" /":"",">")),l=c[t].reduce((g,i,p,u)=>{let h="";return p!==u.length-1&&(h=" "),g+(p===0?a:"")+(s?o.wrapHeadsWith:"")+i+(s?o.wrapTailsWith:"")+h},l)}}else l=c.reduce((t,r,a,g)=>{let i="";o.mergeArraysWithLineBreaks&&a>0&&(i="<br".concat(o.xhtml?" /":"",">"));let p="";return a!==g.length-1&&(p=" "),"".concat(t).concat(a===0?i:"").concat(s?o.wrapHeadsWith:"").concat(r).concat(s?o.wrapTailsWith:"").concat(p)},l);return l}var q="7.0.33";var z=(0,Z.default)(),pe=q;function ge(e,n,s){if(!y(e))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_01] the first input argument must be a plain object! It was given as ".concat(JSON.stringify(e,null,4)," (its typeof was ").concat(typeof e,")."));if(!y(n))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_02] the second input argument must be a plain object! It was given as ".concat(JSON.stringify(n,null,4)," (its typeof was ").concat(typeof n,")."));if(s&&!y(s))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_03] the third input argument must be a plain object! It was given as ".concat(JSON.stringify(s,null,4)," (its typeof was ").concat(typeof s,")."));let f=b(b({},x),s);f.dontWrapKeys=O(f.dontWrapKeys),f.preventWrappingIfContains=O(f.preventWrappingIfContains),f.dontWrapPaths=O(f.dontWrapPaths),f.ignore=O(f.ignore),typeof f.whatToDoWhenReferenceIsMissing!="number"&&(f.whatToDoWhenReferenceIsMissing=+f.whatToDoWhenReferenceIsMissing||0);function o(c,l,t,r=!0,a=!0,g=""){let i=z(c),p=z(l);return t.wrapGlobalFlipSwitch||(r=!1),y(i)?Object.keys(i).forEach(u=>{let h=g+(g.length===0?u:".".concat(u));if(t.ignore.length===0||!t.ignore.includes(u)){if(t.wrapGlobalFlipSwitch&&(r=!0,t.dontWrapKeys.length&&(r=r&&!t.dontWrapKeys.some(d=>V(u,d,{caseSensitive:!0}))),t.dontWrapPaths.length&&(r=r&&!t.dontWrapPaths.some(d=>d===h)),t.preventWrappingIfContains.length&&typeof i[u]=="string"&&(r=r&&!t.preventWrappingIfContains.some(d=>i[u].includes(d)))),j(p[u])||!j(p[u])&&t.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(i[u]))if(t.whatToDoWhenReferenceIsMissing===2||m(p[u]))i[u]=S(i[u],t,r,a);else{if(i[u].every(d=>typeof d=="string"||Array.isArray(d))){let d=!0;i[u].forEach(E=>{Array.isArray(E)&&!E.every(m)&&(d=!1)}),d&&(a=!1)}i[u]=o(i[u],p[u],t,r,a,h)}else y(i[u])?t.whatToDoWhenReferenceIsMissing===2||m(p[u])?i[u]=S($(i[u],t),t,r,a):r?i[u]=o(i[u],p[u],t,r,a,h):i[u]=o(i[u],p[u],M(b({},t),{wrapGlobalFlipSwitch:!1}),r,a,h):m(i[u])&&(i[u]=o(i[u],p[u],t,r,a,h));else if(typeof i[u]!=typeof p[u]&&t.whatToDoWhenReferenceIsMissing===1)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ".concat(u," and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing."))}}):Array.isArray(i)?Array.isArray(p)?i.forEach((u,h)=>{j(i[h])&&j(p[h])?i[h]=o(i[h],p[h],t,r,a,"".concat(g,"[").concat(h,"]")):i[h]=o(i[h],p[0],t,r,a,"".concat(g,"[").concat(h,"]"))}):m(p)&&(i=S(i,t,r,a)):m(i)&&i.length&&(t.wrapHeadsWith||t.wrapTailsWith)&&(!t.preventDoubleWrapping||(t.wrapHeadsWith===""||!T(i,t.wrapHeadsWith.trim()).length)&&(t.wrapTailsWith===""||!T(i,t.wrapTailsWith.trim()).length))&&(i="".concat(r?t.wrapHeadsWith:"").concat(i).concat(r?t.wrapTailsWith:"")),i}return o(e,n,f)}return ae(he);})();
10
+ "use strict";var objectFlattenReferencing=(()=>{var X=Object.create,P=Object.freeze,A=Object.defineProperty,Y=Object.defineProperties,U=Object.getOwnPropertyDescriptor,ee=Object.getOwnPropertyDescriptors,re=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,te=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var _=(e,n,s)=>n in e?A(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s,b=(e,n)=>{for(var s in n||(n={}))R.call(n,s)&&_(e,s,n[s]);if(B)for(var s of B(n))ne.call(n,s)&&_(e,s,n[s]);return e},M=(e,n)=>Y(e,ee(n));var ie=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),se=(e,n)=>{for(var s in n)A(e,s,{get:n[s],enumerable:!0})},L=(e,n,s,f)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of re(n))!R.call(e,o)&&o!==s&&A(e,o,{get:()=>n[o],enumerable:!(f=U(n,o))||f.enumerable});return e};var C=(e,n,s)=>(s=e!=null?X(te(e)):{},L(n||!e||!e.__esModule?A(s,"default",{value:e,enumerable:!0}):s,e)),ae=e=>L(A({},"__esModule",{value:!0}),e);var W=(e,n)=>P(A(e,"raw",{value:P(n||e.slice())}));var v=ie((be,H)=>{"use strict";H.exports=oe;function w(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function oe(e){if(e=e||{},e.circles)return le(e);let n=new Map;if(n.set(Date,l=>new Date(l)),n.set(Map,(l,t)=>new Map(f(Array.from(l),t))),n.set(Set,(l,t)=>new Set(f(Array.from(l),t))),e.constructorHandlers)for(let l of e.constructorHandlers)n.set(l[0],l[1]);let s=null;return e.proto?c:o;function f(l,t){let r=Object.keys(l),a=new Array(r.length);for(let g=0;g<r.length;g++){let i=r[g],p=l[i];typeof p!="object"||p===null?a[i]=p:p.constructor!==Object&&(s=n.get(p.constructor))?a[i]=s(p,t):ArrayBuffer.isView(p)?a[i]=w(p):a[i]=t(p)}return a}function o(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return f(l,o);if(l.constructor!==Object&&(s=n.get(l.constructor)))return s(l,o);let t={};for(let r in l){if(Object.hasOwnProperty.call(l,r)===!1)continue;let a=l[r];typeof a!="object"||a===null?t[r]=a:a.constructor!==Object&&(s=n.get(a.constructor))?t[r]=s(a,o):ArrayBuffer.isView(a)?t[r]=w(a):t[r]=o(a)}return t}function c(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return f(l,c);if(l.constructor!==Object&&(s=n.get(l.constructor)))return s(l,c);let t={};for(let r in l){let a=l[r];typeof a!="object"||a===null?t[r]=a:a.constructor!==Object&&(s=n.get(a.constructor))?t[r]=s(a,c):ArrayBuffer.isView(a)?t[r]=w(a):t[r]=c(a)}return t}}function le(e){let n=[],s=[],f=new Map;if(f.set(Date,r=>new Date(r)),f.set(Map,(r,a)=>new Map(c(Array.from(r),a))),f.set(Set,(r,a)=>new Set(c(Array.from(r),a))),e.constructorHandlers)for(let r of e.constructorHandlers)f.set(r[0],r[1]);let o=null;return e.proto?t:l;function c(r,a){let g=Object.keys(r),i=new Array(g.length);for(let p=0;p<g.length;p++){let u=g[p],h=r[u];if(typeof h!="object"||h===null)i[u]=h;else if(h.constructor!==Object&&(o=f.get(h.constructor)))i[u]=o(h,a);else if(ArrayBuffer.isView(h))i[u]=w(h);else{let d=n.indexOf(h);d!==-1?i[u]=s[d]:i[u]=a(h)}}return i}function l(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return c(r,l);if(r.constructor!==Object&&(o=f.get(r.constructor)))return o(r,l);let a={};n.push(r),s.push(a);for(let g in r){if(Object.hasOwnProperty.call(r,g)===!1)continue;let i=r[g];if(typeof i!="object"||i===null)a[g]=i;else if(i.constructor!==Object&&(o=f.get(i.constructor)))a[g]=o(i,l);else if(ArrayBuffer.isView(i))a[g]=w(i);else{let p=n.indexOf(i);p!==-1?a[g]=s[p]:a[g]=l(i)}}return n.pop(),s.pop(),a}function t(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return c(r,t);if(r.constructor!==Object&&(o=f.get(r.constructor)))return o(r,t);let a={};n.push(r),s.push(a);for(let g in r){let i=r[g];if(typeof i!="object"||i===null)a[g]=i;else if(i.constructor!==Object&&(o=f.get(i.constructor)))a[g]=o(i,t);else if(ArrayBuffer.isView(i))a[g]=w(i);else{let p=n.indexOf(i);p!==-1?a[g]=s[p]:a[g]=t(i)}}return n.pop(),s.pop(),a}}});var he={};se(he,{arrayiffy:()=>O,defaults:()=>x,flattenArr:()=>S,flattenObject:()=>$,flattenReferencing:()=>ge,version:()=>pe});var Z=C(v(),1);function T(e,n,s=0){if(typeof e!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): first input argument must be a string! Currently it's: ".concat(typeof e));if(typeof n!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): second input argument must be a string! Currently it's: ".concat(typeof n));if(isNaN(+s)||typeof s=="string"&&!/^\d*$/.test(s))throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): third input argument must be a natural number! Currently it's: ".concat(s));let f=Array.from(e),o=Array.from(n);if(f.length===0||o.length===0||s!=null&&+s>=f.length)return[];s||(s=0);let c=[],l=!1,t;for(let r=s,a=f.length;r<a;r++)l&&(f[r]===o[r-+t]?r-+t+1===o.length&&c.push(+t):(t=null,l=!1)),l||f[r]===o[0]&&(o.length===1?c.push(r):(l=!0,t=r));return c}function D(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var I=new Map,N=(e,n)=>{if(!Array.isArray(e))switch(typeof e){case"string":{e=[e];break}case"undefined":{e=[];break}default:throw new TypeError("Expected '".concat(n,"' to be a string or an array, but got a type of '").concat(typeof e,"'"))}return e.filter(s=>{if(typeof s!="string"){if(s===void 0)return!1;throw new TypeError("Expected '".concat(n,"' to be an array of strings, but found a type of '").concat(typeof s,"' in the array"))}return!0})},K,F,J,fe=(e,n)=>{n=b({caseSensitive:!1},n);let s="s"+(n.caseSensitive?"":"i"),f=e+"|"+s;if(I.has(f))return I.get(f);let o=e[0]==="!";o&&(e=e.slice(1)),e=e.replaceAll(String.raw(K||(K=W(["*"],["\\*"]))),"__ESCAPED_STAR__").replaceAll("\\\\","__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g,"$1"),e=D(e).replaceAll(String.raw(F||(F=W(["*"],["\\*"]))),".*"),e=e.replaceAll("__ESCAPED_STAR__",String.raw(J||(J=W(["*"],["\\*"])))).replaceAll("__ESCAPED_BACKSLASH__","\\\\");let c=new RegExp("^".concat(e,"$"),s);return c.negated=o,I.set(f,c),c},ce=(e,n,s,f)=>{if(e=N(e,"inputs"),n=N(n,"patterns"),n.length===0)return[];n=n.map(r=>fe(r,s));let o=n.filter(r=>r.negated),c=n.filter(r=>!r.negated),{allPatterns:l}=s||{},t=[];if(l&&f&&o.length>1&&c.length===0){for(let r of e)for(let a of o)if(a.test(r))return[];return e.slice(0,1)}for(let r of e){let a=!1;for(let g of o)if(g.test(r)){a=!0;break}if(!a){if(c.length===0)t.push(r);else if(l){let g=Array.from({length:c.length},()=>!1);for(let[i,p]of c.entries())p.test(r)&&(g[i]=!0);g.every(Boolean)&&t.push(r)}else{let g=!1;for(let i of c)if(i.test(r)){g=!0;break}g&&t.push(r)}if(f&&t.length>0)break}}return t};function V(e,n,s){return ce(e,n,s,!0).length>0}function O(e){return typeof e!="string"?e:e.length?[e]:[]}var G=C(v(),1);var xe=(0,G.default)();function y(e){if(e==null||typeof e!="object")return!1;let n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&Object.getPrototypeOf(n)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function m(e){return typeof e=="string"}function j(e){return e!=null}var Q=C(v(),1);var k=(0,Q.default)(),x={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function $(e,n){let s=b(b({},x),n);if(arguments.length===0||Object.keys(e).length===0)return[];let f=k(e),o=[];return y(f)&&Object.keys(f).forEach(c=>{y(f[c])&&(f[c]=$(f[c],s)),Array.isArray(f[c])&&(o=o.concat(f[c].map(l=>"".concat(c).concat(s.objectKeyAndValueJoinChar).concat(l)))),m(f[c])&&o.push("".concat(c).concat(s.objectKeyAndValueJoinChar).concat(f[c]))}),o}function S(e,n,s=!1,f=!1){let o=b(b({},x),n);if(arguments.length===0||e.length===0)return"";let c=k(e),l="";if(c.length)if(f){for(let t=0,r=c.length;t<r;t++)if(m(c[t])){let a;a="",o.mergeArraysWithLineBreaks&&t>0&&(!o.mergeWithoutTrailingBrIfLineContainsBr||typeof c[t-1]!="string"||o.mergeWithoutTrailingBrIfLineContainsBr&&c[t-1]!==void 0&&!c[t-1].toLowerCase().includes("<br"))&&(a="<br".concat(o.xhtml?" /":"",">")),l+="".concat(a).concat(s?o.wrapHeadsWith:"").concat(c[t]).concat(s?o.wrapTailsWith:"")}else if(Array.isArray(c[t])&&c[t].length&&c[t].every(m)){let a="";o.mergeArraysWithLineBreaks&&l.length&&(a="<br".concat(o.xhtml?" /":"",">")),l=c[t].reduce((g,i,p,u)=>{let h="";return p!==u.length-1&&(h=" "),g+(p===0?a:"")+(s?o.wrapHeadsWith:"")+i+(s?o.wrapTailsWith:"")+h},l)}}else l=c.reduce((t,r,a,g)=>{let i="";o.mergeArraysWithLineBreaks&&a>0&&(i="<br".concat(o.xhtml?" /":"",">"));let p="";return a!==g.length-1&&(p=" "),"".concat(t).concat(a===0?i:"").concat(s?o.wrapHeadsWith:"").concat(r).concat(s?o.wrapTailsWith:"").concat(p)},l);return l}var q="7.1.0";var z=(0,Z.default)(),pe=q;function ge(e,n,s){if(!y(e))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_01] the first input argument must be a plain object! It was given as ".concat(JSON.stringify(e,null,4)," (its typeof was ").concat(typeof e,")."));if(!y(n))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_02] the second input argument must be a plain object! It was given as ".concat(JSON.stringify(n,null,4)," (its typeof was ").concat(typeof n,")."));if(s&&!y(s))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_03] the third input argument must be a plain object! It was given as ".concat(JSON.stringify(s,null,4)," (its typeof was ").concat(typeof s,")."));let f=b(b({},x),s);f.dontWrapKeys=O(f.dontWrapKeys),f.preventWrappingIfContains=O(f.preventWrappingIfContains),f.dontWrapPaths=O(f.dontWrapPaths),f.ignore=O(f.ignore),typeof f.whatToDoWhenReferenceIsMissing!="number"&&(f.whatToDoWhenReferenceIsMissing=+f.whatToDoWhenReferenceIsMissing||0);function o(c,l,t,r=!0,a=!0,g=""){let i=z(c),p=z(l);return t.wrapGlobalFlipSwitch||(r=!1),y(i)?Object.keys(i).forEach(u=>{let h=g+(g.length===0?u:".".concat(u));if(t.ignore.length===0||!t.ignore.includes(u)){if(t.wrapGlobalFlipSwitch&&(r=!0,t.dontWrapKeys.length&&(r=r&&!t.dontWrapKeys.some(d=>V(u,d,{caseSensitive:!0}))),t.dontWrapPaths.length&&(r=r&&!t.dontWrapPaths.some(d=>d===h)),t.preventWrappingIfContains.length&&typeof i[u]=="string"&&(r=r&&!t.preventWrappingIfContains.some(d=>i[u].includes(d)))),j(p[u])||!j(p[u])&&t.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(i[u]))if(t.whatToDoWhenReferenceIsMissing===2||m(p[u]))i[u]=S(i[u],t,r,a);else{if(i[u].every(d=>typeof d=="string"||Array.isArray(d))){let d=!0;i[u].forEach(E=>{Array.isArray(E)&&!E.every(m)&&(d=!1)}),d&&(a=!1)}i[u]=o(i[u],p[u],t,r,a,h)}else y(i[u])?t.whatToDoWhenReferenceIsMissing===2||m(p[u])?i[u]=S($(i[u],t),t,r,a):r?i[u]=o(i[u],p[u],t,r,a,h):i[u]=o(i[u],p[u],M(b({},t),{wrapGlobalFlipSwitch:!1}),r,a,h):m(i[u])&&(i[u]=o(i[u],p[u],t,r,a,h));else if(typeof i[u]!=typeof p[u]&&t.whatToDoWhenReferenceIsMissing===1)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ".concat(u," and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing."))}}):Array.isArray(i)?Array.isArray(p)?i.forEach((u,h)=>{j(i[h])&&j(p[h])?i[h]=o(i[h],p[h],t,r,a,"".concat(g,"[").concat(h,"]")):i[h]=o(i[h],p[0],t,r,a,"".concat(g,"[").concat(h,"]"))}):m(p)&&(i=S(i,t,r,a)):m(i)&&i.length&&(t.wrapHeadsWith||t.wrapTailsWith)&&(!t.preventDoubleWrapping||(t.wrapHeadsWith===""||!T(i,t.wrapHeadsWith.trim()).length)&&(t.wrapTailsWith===""||!T(i,t.wrapTailsWith.trim()).length))&&(i="".concat(r?t.wrapHeadsWith:"").concat(i).concat(r?t.wrapTailsWith:"")),i}return o(e,n,f)}return ae(he);})();
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.20
14
+ * @version 5.1.0
15
15
  * @author Roy Revelt
16
16
  * @license MIT
17
17
  * {@link https://codsen.com/os/str-indexes-of-plus/}
@@ -19,7 +19,7 @@
19
19
  /**
20
20
  * @name arrayiffy-if-string
21
21
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
22
- * @version 5.0.21
22
+ * @version 5.1.0
23
23
  * @author Roy Revelt
24
24
  * @license MIT
25
25
  * {@link https://codsen.com/os/arrayiffy-if-string/}
@@ -27,7 +27,7 @@
27
27
  /**
28
28
  * @name codsen-utils
29
29
  * @fileoverview Various utility functions
30
- * @version 1.6.19
30
+ * @version 1.7.0
31
31
  * @author Roy Revelt
32
32
  * @license MIT
33
33
  * {@link https://codsen.com/os/codsen-utils/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "object-flatten-referencing",
3
- "version": "7.0.33",
3
+ "version": "7.1.0",
4
4
  "description": "Flatten complex nested objects according to a reference objects",
5
5
  "keywords": [
6
6
  "advanced",
@@ -70,11 +70,11 @@
70
70
  }
71
71
  },
72
72
  "dependencies": {
73
- "arrayiffy-if-string": "^5.0.21",
74
- "codsen-utils": "^1.6.19",
73
+ "arrayiffy-if-string": "^5.1.0",
74
+ "codsen-utils": "^1.7.0",
75
75
  "matcher": "^6.0.0",
76
76
  "rfdc": "^1.4.1",
77
- "str-indexes-of-plus": "^5.0.20"
77
+ "str-indexes-of-plus": "^5.1.0"
78
78
  },
79
79
  "publishConfig": {
80
80
  "registry": "https://registry.npmjs.org/"