@nocobase/utils 1.7.0-beta.13 → 1.7.0-beta.14
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/lib/assign.js +11 -4
- package/lib/dayjs.js +2 -0
- package/package.json +2 -2
package/lib/assign.js
CHANGED
|
@@ -53,7 +53,7 @@ function getKeys(target) {
|
|
|
53
53
|
}
|
|
54
54
|
__name(getKeys, "getKeys");
|
|
55
55
|
const mergeStrategies = /* @__PURE__ */ new Map();
|
|
56
|
-
mergeStrategies.set("overwrite", (
|
|
56
|
+
mergeStrategies.set("overwrite", (_2, y) => {
|
|
57
57
|
if (typeof y === "string") {
|
|
58
58
|
y = y.split(",");
|
|
59
59
|
}
|
|
@@ -123,15 +123,22 @@ mergeStrategies.set(
|
|
|
123
123
|
})().filter(Boolean)
|
|
124
124
|
);
|
|
125
125
|
function assign(target, source, strategies = {}) {
|
|
126
|
-
getKeys(source)
|
|
126
|
+
const sourceKeys = getKeys(source);
|
|
127
|
+
const targetKeys = getKeys(target);
|
|
128
|
+
import_lodash.default.uniq([...sourceKeys, ...targetKeys]).forEach((sourceKey) => {
|
|
127
129
|
const strategy = strategies[sourceKey];
|
|
128
|
-
let func
|
|
130
|
+
let func;
|
|
129
131
|
if (typeof strategy === "function") {
|
|
130
132
|
func = strategy;
|
|
131
133
|
} else if (typeof strategy === "string" && mergeStrategies.has(strategy)) {
|
|
132
134
|
func = mergeStrategies.get(strategy);
|
|
133
135
|
}
|
|
134
|
-
|
|
136
|
+
if (func) {
|
|
137
|
+
target[sourceKey] = func(target[sourceKey], source[sourceKey]);
|
|
138
|
+
} else if (sourceKeys.includes(sourceKey)) {
|
|
139
|
+
const func2 = mergeStrategies.get("deepMerge");
|
|
140
|
+
target[sourceKey] = func2(target[sourceKey], source[sourceKey]);
|
|
141
|
+
}
|
|
135
142
|
});
|
|
136
143
|
return target;
|
|
137
144
|
}
|
package/lib/dayjs.js
CHANGED
|
@@ -42,6 +42,7 @@ module.exports = __toCommonJS(dayjs_exports);
|
|
|
42
42
|
var import_dayjs = __toESM(require("dayjs"));
|
|
43
43
|
var import_advancedFormat = __toESM(require("dayjs/plugin/advancedFormat"));
|
|
44
44
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
45
|
+
var import_duration = __toESM(require("dayjs/plugin/duration"));
|
|
45
46
|
var import_isBetween = __toESM(require("dayjs/plugin/isBetween"));
|
|
46
47
|
var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
|
|
47
48
|
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
|
|
@@ -66,6 +67,7 @@ import_dayjs.default.extend(import_weekOfYear.default);
|
|
|
66
67
|
import_dayjs.default.extend(import_weekYear.default);
|
|
67
68
|
import_dayjs.default.extend(import_customParseFormat.default);
|
|
68
69
|
import_dayjs.default.extend(import_advancedFormat.default);
|
|
70
|
+
import_dayjs.default.extend(import_duration.default);
|
|
69
71
|
// Annotate the CommonJS export names for ESM import in node:
|
|
70
72
|
0 && (module.exports = {
|
|
71
73
|
dayjs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/utils",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.14",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"multer": "^1.4.5-lts.1",
|
|
17
17
|
"object-path": "^0.11.8"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "9e557ad4739803ca87d54f279c90ff69511ccdee"
|
|
20
20
|
}
|