object-fill-missing-keys 9.0.6 → 9.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name object-fill-missing-keys
|
|
3
3
|
* @fileoverview Add missing keys into plain objects, according to a reference object
|
|
4
|
-
* @version 9.0.
|
|
4
|
+
* @version 9.0.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/object-fill-missing-keys/}
|
|
@@ -13,7 +13,7 @@ import { arrayiffy } from 'arrayiffy-if-string';
|
|
|
13
13
|
import { allEq } from 'object-all-values-equal-to';
|
|
14
14
|
import isObj from 'lodash.isplainobject';
|
|
15
15
|
|
|
16
|
-
var version$1 = "9.0.
|
|
16
|
+
var version$1 = "9.0.7";
|
|
17
17
|
|
|
18
18
|
const version = version$1;
|
|
19
19
|
const defaults = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name object-fill-missing-keys
|
|
3
3
|
* @fileoverview Add missing keys into plain objects, according to a reference object
|
|
4
|
-
* @version 9.0.
|
|
4
|
+
* @version 9.0.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/object-fill-missing-keys/}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* @name util-nonempty
|
|
13
13
|
* @fileoverview Is the input (plain object, array, string or whatever) not empty?
|
|
14
|
-
* @version 4.0.
|
|
14
|
+
* @version 4.0.7
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/util-nonempty/}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name object-merge-advanced
|
|
21
21
|
* @fileoverview Recursively, deeply merge of anything (objects, arrays, strings or nested thereof), which weighs contents by type hierarchy to ensure the maximum content is retained
|
|
22
|
-
* @version 13.0.
|
|
22
|
+
* @version 13.0.7
|
|
23
23
|
* @author Roy Revelt, Codsen Ltd
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/object-merge-advanced/}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* @name arrayiffy-if-string
|
|
29
29
|
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
|
|
30
|
-
* @version 4.0.
|
|
30
|
+
* @version 4.0.7
|
|
31
31
|
* @author Roy Revelt, Codsen Ltd
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/arrayiffy-if-string/}
|
|
@@ -36,8 +36,8 @@ function Ut(t){return"string"==typeof t?t.length?[t]:[]:t}var Ht={exports:{}};!f
|
|
|
36
36
|
/**
|
|
37
37
|
* @name object-all-values-equal-to
|
|
38
38
|
* @fileoverview Does the AST/nested-plain-object/array/whatever contain only one kind of value?
|
|
39
|
-
* @version 3.0.
|
|
39
|
+
* @version 3.0.7
|
|
40
40
|
* @author Roy Revelt, Codsen Ltd
|
|
41
41
|
* @license MIT
|
|
42
42
|
* {@link https://codsen.com/os/object-all-values-equal-to/}
|
|
43
|
-
*/function Vt(t,e,r){if(Array.isArray(t)){if(0===t.length)return!0;if(r.arraysMustNotContainPlaceholders&&t.length>0&&t.some((t=>qt(t,e))))return!1;for(let n=t.length;n--;)if(!Vt(t[n],e,r))return!1;return!0}if(At(t)){const n=Object.keys(t);if(0===n.length)return!0;for(let o=n.length;o--;)if(!Vt(t[n[o]],e,r))return!1;return!0}return qt(t,e)}function Lt(t,e,r){if(void 0===t)throw new Error("object-all-values-equal-to: [THROW_ID_01] The first input is undefined! Please provide the first argument.");if(void 0===e)throw new Error("object-all-values-equal-to: [THROW_ID_02] The second input is undefined! Please provide the second argument.");if(r&&!At(r))throw new Error(`object-all-values-equal-to: [THROW_ID_03] The third argument, options object, was given not as a plain object but as a ${typeof r}, equal to:\n${JSON.stringify(r,null,4)}`);return Vt(t,e,{arraysMustNotContainPlaceholders:!0,...r})}const Jt={placeholder:!1,doNotFillThesePathsIfTheyContainPlaceholders:[],useNullAsExplicitFalse:!0};function Gt(t){return At(t)?"plain object":Array.isArray(t)?"array":typeof t}function Qt(t){return"string"==typeof t}function Xt(t){return null!=t}function Yt(t,e,r,o=""){const i=n(t);if(Xt(i)||!(o.length&&r.doNotFillThesePathsIfTheyContainPlaceholders.includes(o)&&Lt(i,r.placeholder)))if(At(e)&&At(i))Object.keys(e).forEach((t=>{const n=`${o?`${o}.`:""}${t}`;r.doNotFillThesePathsIfTheyContainPlaceholders.includes(n)&&(Xt(i[t])?Lt(i[t],r.placeholder)&&(i[t]=r.placeholder):i[t]=r.placeholder),Xt(i[t])&&r.doNotFillThesePathsIfTheyContainPlaceholders.includes(n)&&Lt(i[t],r.placeholder)||(i[t]=Yt(i[t],e[t],r,n))}));else{if(!Array.isArray(e)||!Array.isArray(i))return function(t,e,r){if(!arguments.length)throw new TypeError("object-merge-advanced/mergeAdvanced(): [THROW_ID_01] Both inputs are missing");return Wt({key:null,path:"",type:[Bt(t),Bt(e)]},t,e,r)}(e,i,{useNullAsExplicitFalse:r.useNullAsExplicitFalse});if(0===i.length)return e;if(e.length>0)for(let t=i.length;t--;){const n=(o?`${o}.`:"")+"0";(At(e[0])||Array.isArray(e[0]))&&(i[t]=Yt(i[t],e[0],r,n))}}return i}t.fillMissing=function(t,e,r){if(0===arguments.length)throw new Error("object-fill-missing-keys: [THROW_ID_01] All arguments are missing!");if(!At(t))throw new Error(`object-fill-missing-keys: [THROW_ID_02] First argument, input object must be a plain object. Currently it's type is "${Gt(t)}" and it's equal to: ${JSON.stringify(t,null,4)}`);if(!At(e))throw new Error(`object-fill-missing-keys: [THROW_ID_03] Second argument, schema object, must be a plain object. Currently it's type is "${Gt(e)}" and it's equal to: ${JSON.stringify(e,null,4)}`);if(r&&!At(r))throw new Error(`object-fill-missing-keys: [THROW_ID_04] Third argument, schema object, must be a plain object. Currently it's type is "${Gt(r)}" and it's equal to: ${JSON.stringify(r,null,4)}`);const o={...Jt,...r||{}};o.doNotFillThesePathsIfTheyContainPlaceholders=Ut(o.doNotFillThesePathsIfTheyContainPlaceholders);let i=null,a=null;if(o.doNotFillThesePathsIfTheyContainPlaceholders.length>0&&!o.doNotFillThesePathsIfTheyContainPlaceholders.every(((t,e)=>!!Qt(t)||(i=t,a=e,!1))))throw new Error(`object-fill-missing-keys: [THROW_ID_06] opts.doNotFillThesePathsIfTheyContainPlaceholders element with an index number "${a}" is not a string! It's ${Gt(i)}, equal to:\n${JSON.stringify(i,null,4)}`);return Yt(n(t),n(e),o)},t.version="9.0.
|
|
43
|
+
*/function Vt(t,e,r){if(Array.isArray(t)){if(0===t.length)return!0;if(r.arraysMustNotContainPlaceholders&&t.length>0&&t.some((t=>qt(t,e))))return!1;for(let n=t.length;n--;)if(!Vt(t[n],e,r))return!1;return!0}if(At(t)){const n=Object.keys(t);if(0===n.length)return!0;for(let o=n.length;o--;)if(!Vt(t[n[o]],e,r))return!1;return!0}return qt(t,e)}function Lt(t,e,r){if(void 0===t)throw new Error("object-all-values-equal-to: [THROW_ID_01] The first input is undefined! Please provide the first argument.");if(void 0===e)throw new Error("object-all-values-equal-to: [THROW_ID_02] The second input is undefined! Please provide the second argument.");if(r&&!At(r))throw new Error(`object-all-values-equal-to: [THROW_ID_03] The third argument, options object, was given not as a plain object but as a ${typeof r}, equal to:\n${JSON.stringify(r,null,4)}`);return Vt(t,e,{arraysMustNotContainPlaceholders:!0,...r})}const Jt={placeholder:!1,doNotFillThesePathsIfTheyContainPlaceholders:[],useNullAsExplicitFalse:!0};function Gt(t){return At(t)?"plain object":Array.isArray(t)?"array":typeof t}function Qt(t){return"string"==typeof t}function Xt(t){return null!=t}function Yt(t,e,r,o=""){const i=n(t);if(Xt(i)||!(o.length&&r.doNotFillThesePathsIfTheyContainPlaceholders.includes(o)&&Lt(i,r.placeholder)))if(At(e)&&At(i))Object.keys(e).forEach((t=>{const n=`${o?`${o}.`:""}${t}`;r.doNotFillThesePathsIfTheyContainPlaceholders.includes(n)&&(Xt(i[t])?Lt(i[t],r.placeholder)&&(i[t]=r.placeholder):i[t]=r.placeholder),Xt(i[t])&&r.doNotFillThesePathsIfTheyContainPlaceholders.includes(n)&&Lt(i[t],r.placeholder)||(i[t]=Yt(i[t],e[t],r,n))}));else{if(!Array.isArray(e)||!Array.isArray(i))return function(t,e,r){if(!arguments.length)throw new TypeError("object-merge-advanced/mergeAdvanced(): [THROW_ID_01] Both inputs are missing");return Wt({key:null,path:"",type:[Bt(t),Bt(e)]},t,e,r)}(e,i,{useNullAsExplicitFalse:r.useNullAsExplicitFalse});if(0===i.length)return e;if(e.length>0)for(let t=i.length;t--;){const n=(o?`${o}.`:"")+"0";(At(e[0])||Array.isArray(e[0]))&&(i[t]=Yt(i[t],e[0],r,n))}}return i}t.fillMissing=function(t,e,r){if(0===arguments.length)throw new Error("object-fill-missing-keys: [THROW_ID_01] All arguments are missing!");if(!At(t))throw new Error(`object-fill-missing-keys: [THROW_ID_02] First argument, input object must be a plain object. Currently it's type is "${Gt(t)}" and it's equal to: ${JSON.stringify(t,null,4)}`);if(!At(e))throw new Error(`object-fill-missing-keys: [THROW_ID_03] Second argument, schema object, must be a plain object. Currently it's type is "${Gt(e)}" and it's equal to: ${JSON.stringify(e,null,4)}`);if(r&&!At(r))throw new Error(`object-fill-missing-keys: [THROW_ID_04] Third argument, schema object, must be a plain object. Currently it's type is "${Gt(r)}" and it's equal to: ${JSON.stringify(r,null,4)}`);const o={...Jt,...r||{}};o.doNotFillThesePathsIfTheyContainPlaceholders=Ut(o.doNotFillThesePathsIfTheyContainPlaceholders);let i=null,a=null;if(o.doNotFillThesePathsIfTheyContainPlaceholders.length>0&&!o.doNotFillThesePathsIfTheyContainPlaceholders.every(((t,e)=>!!Qt(t)||(i=t,a=e,!1))))throw new Error(`object-fill-missing-keys: [THROW_ID_06] opts.doNotFillThesePathsIfTheyContainPlaceholders element with an index number "${a}" is not a string! It's ${Gt(i)}, equal to:\n${JSON.stringify(i,null,4)}`);return Yt(n(t),n(e),o)},t.version="9.0.7",Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "object-fill-missing-keys",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.7",
|
|
4
4
|
"description": "Add missing keys into plain objects, according to a reference object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"add",
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@babel/runtime": "^7.16.3",
|
|
86
|
-
"arrayiffy-if-string": "^4.0.
|
|
86
|
+
"arrayiffy-if-string": "^4.0.7",
|
|
87
87
|
"lodash.clonedeep": "^4.5.0",
|
|
88
88
|
"lodash.isplainobject": "^4.0.6",
|
|
89
|
-
"object-all-values-equal-to": "^3.0.
|
|
90
|
-
"object-merge-advanced": "^13.0.
|
|
89
|
+
"object-all-values-equal-to": "^3.0.7",
|
|
90
|
+
"object-merge-advanced": "^13.0.7"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@babel/cli": "^7.16.0",
|
|
@@ -111,21 +111,21 @@
|
|
|
111
111
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
112
112
|
"@types/lodash.clonedeep": "^4.5.6",
|
|
113
113
|
"@types/lodash.isplainobject": "^4.0.6",
|
|
114
|
-
"@types/node": "^16.11.
|
|
114
|
+
"@types/node": "^16.11.10",
|
|
115
115
|
"@types/tap": "^15.0.5",
|
|
116
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
117
|
-
"@typescript-eslint/parser": "^5.
|
|
118
|
-
"core-js": "^3.19.
|
|
116
|
+
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
117
|
+
"@typescript-eslint/parser": "^5.5.0",
|
|
118
|
+
"core-js": "^3.19.2",
|
|
119
119
|
"cross-env": "^7.0.3",
|
|
120
120
|
"eslint": "^8.3.0",
|
|
121
|
-
"lect": "^0.18.
|
|
122
|
-
"rollup": "^2.60.
|
|
121
|
+
"lect": "^0.18.7",
|
|
122
|
+
"rollup": "^2.60.1",
|
|
123
123
|
"rollup-plugin-ascii": "^0.0.3",
|
|
124
124
|
"rollup-plugin-banner": "^0.2.1",
|
|
125
125
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
126
126
|
"rollup-plugin-dts": "^4.0.1",
|
|
127
127
|
"rollup-plugin-terser": "^7.0.2",
|
|
128
|
-
"tap": "^15.1.
|
|
128
|
+
"tap": "^15.1.5",
|
|
129
129
|
"tslib": "^2.3.1",
|
|
130
130
|
"typescript": "^4.5.2"
|
|
131
131
|
},
|