@cyberskill/shared 2.8.0 → 2.8.1
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("lodash-es");var g=Object.defineProperty,v=Object.defineProperties,O=Object.getOwnPropertyDescriptors,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("lodash-es");var g=Object.defineProperty,v=Object.defineProperties,O=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,u=(r,e,t)=>e in r?g(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l=(r,e)=>{for(var t in e||(e={}))b.call(e,t)&&u(r,t,e[t]);if(a)for(var t of a(e))h.call(e,t)&&u(r,t,e[t]);return r},c=(r,e)=>v(r,O(e));function _(r){try{return JSON.parse(r),!0}catch(e){return!1}}function j(r,e){return e.reduce((t,n)=>{if(t&&typeof t=="object"&&n in t)return t[n]},r)}function f(r,e,t){if(e.length===0)return r;const[n,...o]=e;if(o.length===0)return c(l({},r),{[n]:t});const s=r[n];return c(l({},r),{[n]:f(typeof s=="object"&&s!==null?s:{},o,t)})}function w(...r){if(r.length===0)return{};const e=r.filter(o=>o!=null).map(o=>typeof o!="object"?{}:o);if(e.length===0)return{};if(e.length===1)return e[0];if(e.every(i.isArray))return[].concat(...e);if(e.every(o=>typeof o=="object"&&o!==null&&!i.isArray(o)))return i.mergeWith({},...e,(o,s)=>{if(i.isArray(o)&&i.isArray(s))return o.concat(s)});if(e.every(o=>typeof o!="object"||o===null))throw new Error("deepMerge: Cannot merge primitive values. All arguments must be objects or arrays.");const t=e.some(i.isArray),n=e.some(o=>typeof o=="object"&&o!==null&&!i.isArray(o));throw t&&n?new Error("deepMerge: Cannot mix arrays and objects. All arguments must be either arrays or objects."):new Error("deepMerge: Invalid arguments provided. All arguments must be objects or arrays of the same type.")}function p(r){if(!r||typeof r!="object")return r;const e={};for(const[t,n]of Object.entries(r))if(n&&typeof n=="object"&&!Array.isArray(n))if(Object.keys(n).some(s=>s.startsWith("$")))e[t]=n;else{const s=p(n);for(const[y,d]of Object.entries(s)){const m=`${t}.${y}`;e[m]=d}}else e[t]=n;return e}exports.deepMerge=w;exports.getNestedValue=j;exports.isJSON=_;exports.normalizeMongoFilter=p;exports.setNestedValue=f;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { isArray as i, mergeWith as
|
|
2
|
-
var
|
|
1
|
+
import { isArray as i, mergeWith as d } from "lodash-es";
|
|
2
|
+
var m = Object.defineProperty, v = Object.defineProperties, O = Object.getOwnPropertyDescriptors, a = Object.getOwnPropertySymbols, b = Object.prototype.hasOwnProperty, h = Object.prototype.propertyIsEnumerable, u = (r, e, t) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, f = (r, e) => {
|
|
3
3
|
for (var t in e || (e = {}))
|
|
4
|
-
|
|
4
|
+
b.call(e, t) && u(r, t, e[t]);
|
|
5
5
|
if (a)
|
|
6
6
|
for (var t of a(e))
|
|
7
|
-
|
|
7
|
+
h.call(e, t) && u(r, t, e[t]);
|
|
8
8
|
return r;
|
|
9
|
-
}, c = (r, e) =>
|
|
9
|
+
}, c = (r, e) => v(r, O(e));
|
|
10
10
|
function w(r) {
|
|
11
11
|
try {
|
|
12
12
|
return JSON.parse(r), !0;
|
|
@@ -20,7 +20,7 @@ function P(r, e) {
|
|
|
20
20
|
return t[n];
|
|
21
21
|
}, r);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function _(r, e, t) {
|
|
24
24
|
if (e.length === 0)
|
|
25
25
|
return r;
|
|
26
26
|
const [n, ...o] = e;
|
|
@@ -30,7 +30,7 @@ function g(r, e, t) {
|
|
|
30
30
|
});
|
|
31
31
|
const s = r[n];
|
|
32
32
|
return c(f({}, r), {
|
|
33
|
-
[n]:
|
|
33
|
+
[n]: _(
|
|
34
34
|
typeof s == "object" && s !== null ? s : {},
|
|
35
35
|
o,
|
|
36
36
|
t
|
|
@@ -50,7 +50,7 @@ function A(...r) {
|
|
|
50
50
|
if (e.every(
|
|
51
51
|
(o) => typeof o == "object" && o !== null && !i(o)
|
|
52
52
|
))
|
|
53
|
-
return
|
|
53
|
+
return d({}, ...e, (o, s) => {
|
|
54
54
|
if (i(o) && i(s))
|
|
55
55
|
return o.concat(s);
|
|
56
56
|
});
|
|
@@ -67,7 +67,7 @@ function A(...r) {
|
|
|
67
67
|
"deepMerge: Invalid arguments provided. All arguments must be objects or arrays of the same type."
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function g(r) {
|
|
71
71
|
if (!r || typeof r != "object")
|
|
72
72
|
return r;
|
|
73
73
|
const e = {};
|
|
@@ -76,12 +76,12 @@ function l(r) {
|
|
|
76
76
|
if (Object.keys(n).some(
|
|
77
77
|
(s) => s.startsWith("$")
|
|
78
78
|
))
|
|
79
|
-
e[t] =
|
|
79
|
+
e[t] = n;
|
|
80
80
|
else {
|
|
81
|
-
const s =
|
|
82
|
-
for (const [
|
|
83
|
-
const
|
|
84
|
-
e[
|
|
81
|
+
const s = g(n);
|
|
82
|
+
for (const [l, p] of Object.entries(s)) {
|
|
83
|
+
const y = `${t}.${l}`;
|
|
84
|
+
e[y] = p;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
else
|
|
@@ -92,6 +92,6 @@ export {
|
|
|
92
92
|
A as deepMerge,
|
|
93
93
|
P as getNestedValue,
|
|
94
94
|
w as isJSON,
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
g as normalizeMongoFilter,
|
|
96
|
+
_ as setNestedValue
|
|
97
97
|
};
|