@aimidy/util 1.0.2 → 1.0.4

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/index.d.mts CHANGED
@@ -1,3 +1,49 @@
1
- declare function add(a: number, b: number): number;
1
+ /**
2
+ * 動態設定多層物件的參數
3
+ * @param data 被設定的物件
4
+ * @param key 位置
5
+ * @param value 參數
6
+ * @returns
7
+ */
8
+ declare function data_set(data: any, key: string, value: any): void;
2
9
 
3
- export { add };
10
+ /**
11
+ * 透過遞迴複製物件
12
+ * @param o
13
+ * @returns
14
+ */
15
+ declare function recursiveDeepCopy<T = any>(o: T): T;
16
+
17
+ /**
18
+ * 判斷資料是否為空值
19
+ * @param data
20
+ * @returns
21
+ */
22
+ declare function emptyData(data: any): boolean;
23
+
24
+ /**
25
+ * 回傳物體的型態
26
+ * @param obj
27
+ * @returns
28
+ */
29
+ declare function gettype<T = any>(obj: T): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "array" | "date" | "null";
30
+
31
+ /**
32
+ * 兩個參數的合併(只能是物件或者陣列)
33
+ * 如果是空值就回傳空物件
34
+ * @param value1
35
+ * @param value2
36
+ * @returns
37
+ */
38
+ declare function parameterMerge(value1?: any, value2?: any): any;
39
+
40
+ declare const index_data_set: typeof data_set;
41
+ declare const index_emptyData: typeof emptyData;
42
+ declare const index_gettype: typeof gettype;
43
+ declare const index_parameterMerge: typeof parameterMerge;
44
+ declare const index_recursiveDeepCopy: typeof recursiveDeepCopy;
45
+ declare namespace index {
46
+ export { index_data_set as data_set, index_emptyData as emptyData, index_gettype as gettype, index_parameterMerge as parameterMerge, index_recursiveDeepCopy as recursiveDeepCopy };
47
+ }
48
+
49
+ export { index as help };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,49 @@
1
- declare function add(a: number, b: number): number;
1
+ /**
2
+ * 動態設定多層物件的參數
3
+ * @param data 被設定的物件
4
+ * @param key 位置
5
+ * @param value 參數
6
+ * @returns
7
+ */
8
+ declare function data_set(data: any, key: string, value: any): void;
2
9
 
3
- export { add };
10
+ /**
11
+ * 透過遞迴複製物件
12
+ * @param o
13
+ * @returns
14
+ */
15
+ declare function recursiveDeepCopy<T = any>(o: T): T;
16
+
17
+ /**
18
+ * 判斷資料是否為空值
19
+ * @param data
20
+ * @returns
21
+ */
22
+ declare function emptyData(data: any): boolean;
23
+
24
+ /**
25
+ * 回傳物體的型態
26
+ * @param obj
27
+ * @returns
28
+ */
29
+ declare function gettype<T = any>(obj: T): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "array" | "date" | "null";
30
+
31
+ /**
32
+ * 兩個參數的合併(只能是物件或者陣列)
33
+ * 如果是空值就回傳空物件
34
+ * @param value1
35
+ * @param value2
36
+ * @returns
37
+ */
38
+ declare function parameterMerge(value1?: any, value2?: any): any;
39
+
40
+ declare const index_data_set: typeof data_set;
41
+ declare const index_emptyData: typeof emptyData;
42
+ declare const index_gettype: typeof gettype;
43
+ declare const index_parameterMerge: typeof parameterMerge;
44
+ declare const index_recursiveDeepCopy: typeof recursiveDeepCopy;
45
+ declare namespace index {
46
+ export { index_data_set as data_set, index_emptyData as emptyData, index_gettype as gettype, index_parameterMerge as parameterMerge, index_recursiveDeepCopy as recursiveDeepCopy };
47
+ }
48
+
49
+ export { index as help };
package/dist/index.js CHANGED
@@ -20,14 +20,94 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- add: () => add
23
+ help: () => help_exports
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
- function add(a, b) {
27
- return a + b;
26
+
27
+ // src/help/index.ts
28
+ var help_exports = {};
29
+ __export(help_exports, {
30
+ data_set: () => data_set,
31
+ emptyData: () => emptyData,
32
+ gettype: () => gettype,
33
+ parameterMerge: () => parameterMerge,
34
+ recursiveDeepCopy: () => recursiveDeepCopy
35
+ });
36
+
37
+ // src/help/data_set/data_set.ts
38
+ function data_set(data, key, value) {
39
+ const keys = key.split(".");
40
+ const firstKey = keys.shift();
41
+ if (!firstKey)
42
+ return;
43
+ if (!(firstKey in data))
44
+ data[firstKey] = {};
45
+ if (keys.length < 1) {
46
+ data[firstKey] = value;
47
+ return;
48
+ }
49
+ data_set(data[firstKey], keys.join("."), value);
50
+ }
51
+
52
+ // src/help/recursiveDeepCopy/recursiveDeepCopy.ts
53
+ function recursiveDeepCopy(o) {
54
+ switch (Object.prototype.toString.apply(o)) {
55
+ case "[object Array]":
56
+ const tempArry = [];
57
+ o.forEach((value) => {
58
+ tempArry.push(recursiveDeepCopy(value));
59
+ });
60
+ return tempArry;
61
+ case "[object Object]":
62
+ const tempO = {};
63
+ Object.keys(o).forEach((key) => {
64
+ if (Object.prototype.hasOwnProperty.call(o, key))
65
+ tempO[key] = recursiveDeepCopy(o[key]);
66
+ });
67
+ return tempO;
68
+ default:
69
+ return o;
70
+ }
71
+ }
72
+
73
+ // src/help/emptyData/emptyData.ts
74
+ function emptyData(data) {
75
+ return typeof data === "undefined" || data === null;
76
+ }
77
+
78
+ // src/help/gettype/gettype.ts
79
+ function gettype(obj) {
80
+ switch (true) {
81
+ case obj instanceof Array:
82
+ return "array";
83
+ case obj instanceof Date:
84
+ return "date";
85
+ case obj === null:
86
+ return "null";
87
+ default:
88
+ return typeof obj;
89
+ }
90
+ }
91
+
92
+ // src/help/parameterMerge/parameterMerge.ts
93
+ function parameterMerge(value1, value2) {
94
+ const type1 = gettype(value1);
95
+ const type2 = gettype(value2);
96
+ switch (true) {
97
+ case ((type1 === "undefined" || type1 === "null") && !!value2):
98
+ return value2;
99
+ case ((type2 === "undefined" || type2 === "null") && !!value1):
100
+ return value1;
101
+ case (type1 === "array" && type1 === type2):
102
+ return [...value1, ...value2];
103
+ case (type1 === "object" && type1 === type2):
104
+ return Object.assign(recursiveDeepCopy(value1), value2);
105
+ default:
106
+ return {};
107
+ }
28
108
  }
29
109
  // Annotate the CommonJS export names for ESM import in node:
30
110
  0 && (module.exports = {
31
- add
111
+ help
32
112
  });
33
113
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export function add(a: number, b: number): number {\r\n return a + b;\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,IAAI,GAAW,GAAmB;AAC9C,SAAO,IAAI;AACf;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/help/index.ts","../src/help/data_set/data_set.ts","../src/help/recursiveDeepCopy/recursiveDeepCopy.ts","../src/help/emptyData/emptyData.ts","../src/help/gettype/gettype.ts","../src/help/parameterMerge/parameterMerge.ts"],"sourcesContent":["export * as help from './help';","export * from './data_set/data_set';\r\nexport * from './recursiveDeepCopy/recursiveDeepCopy';\r\nexport * from './emptyData/emptyData';\r\nexport * from './gettype/gettype';\r\nexport * from './parameterMerge/parameterMerge';","/**\r\n * 動態設定多層物件的參數\r\n * @param data 被設定的物件\r\n * @param key 位置\r\n * @param value 參數\r\n * @returns \r\n */\r\nexport function data_set(data: any, key: string, value: any) {\r\n const keys = key.split(\".\");\r\n const firstKey = keys.shift();\r\n if (!firstKey) return;\r\n\r\n if (!(firstKey in data))\r\n data[firstKey] = {};\r\n\r\n if (keys.length < 1) {\r\n data[firstKey] = value;\r\n return\r\n }\r\n data_set(data[firstKey], keys.join(\".\"), value);\r\n}","/**\r\n* 透過遞迴複製物件\r\n* @param o \r\n* @returns \r\n*/\r\nexport function recursiveDeepCopy<T = any>(o: T): T {\r\n switch (Object.prototype.toString.apply(o)) {\r\n case \"[object Array]\":\r\n const tempArry: any = [];\r\n (o as Array<any>).forEach(value => {\r\n (tempArry as Array<any>).push(recursiveDeepCopy(value));\r\n })\r\n return tempArry;\r\n case \"[object Object]\":\r\n const tempO: any = {};\r\n Object.keys(o as Object).forEach(key => {\r\n if (Object.prototype.hasOwnProperty.call(o, key))\r\n tempO[key] = recursiveDeepCopy((o as { [_: string]: any })[key]);\r\n })\r\n return tempO;\r\n default:\r\n return o;\r\n }\r\n}","/**\r\n * 判斷資料是否為空值\r\n * @param data \r\n * @returns \r\n */\r\nexport function emptyData(data: any) {\r\n return typeof data === \"undefined\" || data === null\r\n}","/**\r\n * 回傳物體的型態\r\n * @param obj \r\n * @returns \r\n */\r\nexport function gettype<T = any>(obj: T) {\r\n switch (true) {\r\n case obj instanceof Array:\r\n return 'array';\r\n case obj instanceof Date:\r\n return 'date';\r\n case obj === null:\r\n return 'null';\r\n default:\r\n return typeof obj;\r\n }\r\n}","import { gettype, recursiveDeepCopy } from \"..\";\r\n\r\n/**\r\n * 兩個參數的合併(只能是物件或者陣列)\r\n * 如果是空值就回傳空物件\r\n * @param value1 \r\n * @param value2 \r\n * @returns \r\n */\r\nexport function parameterMerge(value1?: any, value2?: any) {\r\n const type1 = gettype(value1);\r\n const type2 = gettype(value2);\r\n\r\n switch (true) {\r\n case (type1 === \"undefined\" || type1 === \"null\") && !!value2:\r\n return value2;\r\n case (type2 === \"undefined\" || type2 === \"null\") && !!value1:\r\n return value1;\r\n case type1 === \"array\" && type1 === type2:\r\n return [...value1, ...value2];\r\n case type1 === \"object\" && type1 === type2:\r\n return Object.assign(recursiveDeepCopy(value1), value2);\r\n default:\r\n return {};\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,SAAS,SAAS,MAAW,KAAa,OAAY;AACzD,QAAM,OAAO,IAAI,MAAM,GAAG;AAC1B,QAAM,WAAW,KAAK,MAAM;AAC5B,MAAI,CAAC;AAAU;AAEf,MAAI,EAAE,YAAY;AACd,SAAK,QAAQ,IAAI,CAAC;AAEtB,MAAI,KAAK,SAAS,GAAG;AACjB,SAAK,QAAQ,IAAI;AACjB;AAAA,EACJ;AACA,WA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1D;AACI,aAAO,CAAC;AAAA,EAChB;AACJ;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,8 +1,92 @@
1
- // src/index.ts
2
- function add(a, b) {
3
- return a + b;
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/help/index.ts
8
+ var help_exports = {};
9
+ __export(help_exports, {
10
+ data_set: () => data_set,
11
+ emptyData: () => emptyData,
12
+ gettype: () => gettype,
13
+ parameterMerge: () => parameterMerge,
14
+ recursiveDeepCopy: () => recursiveDeepCopy
15
+ });
16
+
17
+ // src/help/data_set/data_set.ts
18
+ function data_set(data, key, value) {
19
+ const keys = key.split(".");
20
+ const firstKey = keys.shift();
21
+ if (!firstKey)
22
+ return;
23
+ if (!(firstKey in data))
24
+ data[firstKey] = {};
25
+ if (keys.length < 1) {
26
+ data[firstKey] = value;
27
+ return;
28
+ }
29
+ data_set(data[firstKey], keys.join("."), value);
30
+ }
31
+
32
+ // src/help/recursiveDeepCopy/recursiveDeepCopy.ts
33
+ function recursiveDeepCopy(o) {
34
+ switch (Object.prototype.toString.apply(o)) {
35
+ case "[object Array]":
36
+ const tempArry = [];
37
+ o.forEach((value) => {
38
+ tempArry.push(recursiveDeepCopy(value));
39
+ });
40
+ return tempArry;
41
+ case "[object Object]":
42
+ const tempO = {};
43
+ Object.keys(o).forEach((key) => {
44
+ if (Object.prototype.hasOwnProperty.call(o, key))
45
+ tempO[key] = recursiveDeepCopy(o[key]);
46
+ });
47
+ return tempO;
48
+ default:
49
+ return o;
50
+ }
51
+ }
52
+
53
+ // src/help/emptyData/emptyData.ts
54
+ function emptyData(data) {
55
+ return typeof data === "undefined" || data === null;
56
+ }
57
+
58
+ // src/help/gettype/gettype.ts
59
+ function gettype(obj) {
60
+ switch (true) {
61
+ case obj instanceof Array:
62
+ return "array";
63
+ case obj instanceof Date:
64
+ return "date";
65
+ case obj === null:
66
+ return "null";
67
+ default:
68
+ return typeof obj;
69
+ }
70
+ }
71
+
72
+ // src/help/parameterMerge/parameterMerge.ts
73
+ function parameterMerge(value1, value2) {
74
+ const type1 = gettype(value1);
75
+ const type2 = gettype(value2);
76
+ switch (true) {
77
+ case ((type1 === "undefined" || type1 === "null") && !!value2):
78
+ return value2;
79
+ case ((type2 === "undefined" || type2 === "null") && !!value1):
80
+ return value1;
81
+ case (type1 === "array" && type1 === type2):
82
+ return [...value1, ...value2];
83
+ case (type1 === "object" && type1 === type2):
84
+ return Object.assign(recursiveDeepCopy(value1), value2);
85
+ default:
86
+ return {};
87
+ }
4
88
  }
5
89
  export {
6
- add
90
+ help_exports as help
7
91
  };
8
92
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export function add(a: number, b: number): number {\r\n return a + b;\r\n}"],"mappings":";AAAO,SAAS,IAAI,GAAW,GAAmB;AAC9C,SAAO,IAAI;AACf;","names":[]}
1
+ {"version":3,"sources":["../src/help/index.ts","../src/help/data_set/data_set.ts","../src/help/recursiveDeepCopy/recursiveDeepCopy.ts","../src/help/emptyData/emptyData.ts","../src/help/gettype/gettype.ts","../src/help/parameterMerge/parameterMerge.ts"],"sourcesContent":["export * from './data_set/data_set';\r\nexport * from './recursiveDeepCopy/recursiveDeepCopy';\r\nexport * from './emptyData/emptyData';\r\nexport * from './gettype/gettype';\r\nexport * from './parameterMerge/parameterMerge';","/**\r\n * 動態設定多層物件的參數\r\n * @param data 被設定的物件\r\n * @param key 位置\r\n * @param value 參數\r\n * @returns \r\n */\r\nexport function data_set(data: any, key: string, value: any) {\r\n const keys = key.split(\".\");\r\n const firstKey = keys.shift();\r\n if (!firstKey) return;\r\n\r\n if (!(firstKey in data))\r\n data[firstKey] = {};\r\n\r\n if (keys.length < 1) {\r\n data[firstKey] = value;\r\n return\r\n }\r\n data_set(data[firstKey], keys.join(\".\"), value);\r\n}","/**\r\n* 透過遞迴複製物件\r\n* @param o \r\n* @returns \r\n*/\r\nexport function recursiveDeepCopy<T = any>(o: T): T {\r\n switch (Object.prototype.toString.apply(o)) {\r\n case \"[object Array]\":\r\n const tempArry: any = [];\r\n (o as Array<any>).forEach(value => {\r\n (tempArry as Array<any>).push(recursiveDeepCopy(value));\r\n })\r\n return tempArry;\r\n case \"[object Object]\":\r\n const tempO: any = {};\r\n Object.keys(o as Object).forEach(key => {\r\n if (Object.prototype.hasOwnProperty.call(o, key))\r\n tempO[key] = recursiveDeepCopy((o as { [_: string]: any })[key]);\r\n })\r\n return tempO;\r\n default:\r\n return o;\r\n }\r\n}","/**\r\n * 判斷資料是否為空值\r\n * @param data \r\n * @returns \r\n */\r\nexport function emptyData(data: any) {\r\n return typeof data === \"undefined\" || data === null\r\n}","/**\r\n * 回傳物體的型態\r\n * @param obj \r\n * @returns \r\n */\r\nexport function gettype<T = any>(obj: T) {\r\n switch (true) {\r\n case obj instanceof Array:\r\n return 'array';\r\n case obj instanceof Date:\r\n return 'date';\r\n case obj === null:\r\n return 'null';\r\n default:\r\n return typeof obj;\r\n }\r\n}","import { gettype, recursiveDeepCopy } from \"..\";\r\n\r\n/**\r\n * 兩個參數的合併(只能是物件或者陣列)\r\n * 如果是空值就回傳空物件\r\n * @param value1 \r\n * @param value2 \r\n * @returns \r\n */\r\nexport function parameterMerge(value1?: any, value2?: any) {\r\n const type1 = gettype(value1);\r\n const type2 = gettype(value2);\r\n\r\n switch (true) {\r\n case (type1 === \"undefined\" || type1 === \"null\") && !!value2:\r\n return value2;\r\n case (type2 === \"undefined\" || type2 === \"null\") && !!value1:\r\n return value1;\r\n case type1 === \"array\" && type1 === type2:\r\n return [...value1, ...value2];\r\n case type1 === \"object\" && type1 === type2:\r\n return Object.assign(recursiveDeepCopy(value1), value2);\r\n default:\r\n return {};\r\n }\r\n}"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,SAAS,SAAS,MAAW,KAAa,OAAY;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OAAM,UAAU,eAAe,UAAU,WAAW,CAAC,CAAC;AAClD,aAAO;AAAA,IACX,MAAK,UAAU,WAAW,UAAU;AAChC,aAAO,CAAC,GAAG,QAAQ,GAAG,MAAM;AAAA,IAChC,MAAK,UAAU,YAAY,UAAU;AACjC,aAAO,OAAO,OAAO,kBAAkB,MAAM,GAAG,MAAM;AAAA,IAC1D;AACI,aAAO,CAAC;AAAA,EAChB;AACJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aimidy/util",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -13,6 +13,10 @@
13
13
  "test": "jest",
14
14
  "push": "npm publish --access=public"
15
15
  },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/aimidy/util.get"
19
+ },
16
20
  "keywords": [
17
21
  "demo",
18
22
  "typescript",
package/dist/help.d.mts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * 動態設定多層物件的參數
3
- * @param data 被設定的物件
4
- * @param key 位置
5
- * @param value 參數
6
- * @returns
7
- */
8
- declare function data_set(data: any, key: string, value: any): void;
9
-
10
- export { data_set };
package/dist/help.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * 動態設定多層物件的參數
3
- * @param data 被設定的物件
4
- * @param key 位置
5
- * @param value 參數
6
- * @returns
7
- */
8
- declare function data_set(data: any, key: string, value: any): void;
9
-
10
- export { data_set };
package/dist/help.js DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/help.ts
21
- var help_exports = {};
22
- __export(help_exports, {
23
- data_set: () => data_set
24
- });
25
- module.exports = __toCommonJS(help_exports);
26
- function data_set(data, key, value) {
27
- const keys = key.split(".");
28
- const firstKey = keys.shift();
29
- if (!firstKey)
30
- return;
31
- if (!(firstKey in data))
32
- data[firstKey] = {};
33
- if (keys.length < 1) {
34
- data[firstKey] = value;
35
- return;
36
- }
37
- data_set(data[firstKey], keys.join("."), value);
38
- }
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- data_set
42
- });
43
- //# sourceMappingURL=help.js.map
package/dist/help.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/help.ts"],"sourcesContent":["/**\r\n * 動態設定多層物件的參數\r\n * @param data 被設定的物件\r\n * @param key 位置\r\n * @param value 參數\r\n * @returns \r\n */\r\nexport function data_set(data: any, key: string, value: any) {\r\n const keys = key.split(\".\");\r\n const firstKey = keys.shift();\r\n if (!firstKey) return;\r\n \r\n if (!(firstKey in data))\r\n data[firstKey] = {};\r\n \r\n if (keys.length < 1) {\r\n data[firstKey] = value;\r\n return\r\n }\r\n data_set(data[firstKey], keys.join(\".\"), value);\r\n }"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,SAAS,MAAW,KAAa,OAAY;AACzD,QAAM,OAAO,IAAI,MAAM,GAAG;AAC1B,QAAM,WAAW,KAAK,MAAM;AAC5B,MAAI,CAAC;AAAU;AAEf,MAAI,EAAE,YAAY;AAChB,SAAK,QAAQ,IAAI,CAAC;AAEpB,MAAI,KAAK,SAAS,GAAG;AACnB,SAAK,QAAQ,IAAI;AACjB;AAAA,EACF;AACA,WAAS,KAAK,QAAQ,GAAG,KAAK,KAAK,GAAG,GAAG,KAAK;AAChD;","names":[]}
package/dist/help.mjs DELETED
@@ -1,18 +0,0 @@
1
- // src/help.ts
2
- function data_set(data, key, value) {
3
- const keys = key.split(".");
4
- const firstKey = keys.shift();
5
- if (!firstKey)
6
- return;
7
- if (!(firstKey in data))
8
- data[firstKey] = {};
9
- if (keys.length < 1) {
10
- data[firstKey] = value;
11
- return;
12
- }
13
- data_set(data[firstKey], keys.join("."), value);
14
- }
15
- export {
16
- data_set
17
- };
18
- //# sourceMappingURL=help.mjs.map
package/dist/help.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/help.ts"],"sourcesContent":["/**\r\n * 動態設定多層物件的參數\r\n * @param data 被設定的物件\r\n * @param key 位置\r\n * @param value 參數\r\n * @returns \r\n */\r\nexport function data_set(data: any, key: string, value: any) {\r\n const keys = key.split(\".\");\r\n const firstKey = keys.shift();\r\n if (!firstKey) return;\r\n \r\n if (!(firstKey in data))\r\n data[firstKey] = {};\r\n \r\n if (keys.length < 1) {\r\n data[firstKey] = value;\r\n return\r\n }\r\n data_set(data[firstKey], keys.join(\".\"), value);\r\n }"],"mappings":";AAOO,SAAS,SAAS,MAAW,KAAa,OAAY;AACzD,QAAM,OAAO,IAAI,MAAM,GAAG;AAC1B,QAAM,WAAW,KAAK,MAAM;AAC5B,MAAI,CAAC;AAAU;AAEf,MAAI,EAAE,YAAY;AAChB,SAAK,QAAQ,IAAI,CAAC;AAEpB,MAAI,KAAK,SAAS,GAAG;AACnB,SAAK,QAAQ,IAAI;AACjB;AAAA,EACF;AACA,WAAS,KAAK,QAAQ,GAAG,KAAK,KAAK,GAAG,GAAG,KAAK;AAChD;","names":[]}