@finema/core 1.4.58 → 1.4.60
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/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/utils/ArrayHelper.mjs +1 -1
- package/dist/runtime/utils/ArrayHelper.spec.mjs +5 -1
- package/dist/runtime/utils/ObjectHelper.mjs +1 -1
- package/dist/runtime/utils/lodash.d.ts +1 -0
- package/dist/runtime/utils/lodash.mjs +12 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { get } from "lodash";
|
|
2
|
+
import { describe, test, expect, vi } from "vitest";
|
|
2
3
|
import { ArrayHelper } from "./ArrayHelper.mjs";
|
|
4
|
+
vi.mock("#build/imports", () => ({
|
|
5
|
+
_get: get
|
|
6
|
+
}));
|
|
3
7
|
describe("ArrayHelper", () => {
|
|
4
8
|
test("toOptions default attr", () => {
|
|
5
9
|
const data = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ParamHelper } from "./ParamHelper.mjs";
|
|
2
2
|
import { _get } from "#build/imports";
|
|
3
|
-
import { _isEmpty } from "
|
|
3
|
+
import { _isEmpty } from "./lodash.mjs";
|
|
4
4
|
export class ObjectHelper {
|
|
5
5
|
static createOption(value, label = "") {
|
|
6
6
|
return {
|
|
@@ -16,3 +16,15 @@ export const _deepMerge = (target, ...sources) => {
|
|
|
16
16
|
}
|
|
17
17
|
return _deepMerge(target, ...sources);
|
|
18
18
|
};
|
|
19
|
+
export const _isEmpty = (value) => {
|
|
20
|
+
if (value === null || value === void 0) {
|
|
21
|
+
return true;
|
|
22
|
+
} else if (Array.isArray(value) || typeof value === "string") {
|
|
23
|
+
return value.length === 0;
|
|
24
|
+
} else if (typeof value === "object") {
|
|
25
|
+
return Object.keys(value).length === 0;
|
|
26
|
+
} else if (typeof value.size === "number") {
|
|
27
|
+
return value.size === 0;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|