@senhainfo/shared-utils 1.1.9 → 1.1.11
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,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
[K in keyof T]: {
|
|
5
|
-
name: K;
|
|
6
|
-
value: T[K];
|
|
7
|
-
};
|
|
8
|
-
}[keyof T]>;
|
|
9
|
-
}
|
|
1
|
+
type AssignDefaultValuesProps<T> = {
|
|
2
|
+
[K in keyof T]?: T[K];
|
|
3
|
+
};
|
|
10
4
|
/**
|
|
11
5
|
* Assign default values to entity attributes
|
|
12
6
|
*
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {T}
|
|
15
|
-
* @
|
|
7
|
+
* @param {T} entity - The entity to assign default values
|
|
8
|
+
* @param {AssignDefaultValuesProps<T>} attributes - The attributes to assign default values
|
|
9
|
+
* @returns {void}
|
|
16
10
|
*/
|
|
17
|
-
export declare function assignDefaultValues<T>(
|
|
11
|
+
export declare function assignDefaultValues<T>(entity: T, attributes: AssignDefaultValuesProps<T>): void;
|
|
18
12
|
export {};
|
|
19
13
|
//# sourceMappingURL=assign-default-values.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assign-default-values.d.ts","sourceRoot":"","sources":["../src/assign-default-values.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"assign-default-values.d.ts","sourceRoot":"","sources":["../src/assign-default-values.ts"],"names":[],"mappings":"AAAA,KAAK,wBAAwB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,IAAI,CAM/F"}
|
|
@@ -4,14 +4,14 @@ exports.assignDefaultValues = assignDefaultValues;
|
|
|
4
4
|
/**
|
|
5
5
|
* Assign default values to entity attributes
|
|
6
6
|
*
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {T}
|
|
9
|
-
* @
|
|
7
|
+
* @param {T} entity - The entity to assign default values
|
|
8
|
+
* @param {AssignDefaultValuesProps<T>} attributes - The attributes to assign default values
|
|
9
|
+
* @returns {void}
|
|
10
10
|
*/
|
|
11
|
-
function assignDefaultValues(
|
|
12
|
-
for (const
|
|
13
|
-
if (entity[
|
|
14
|
-
entity[
|
|
11
|
+
function assignDefaultValues(entity, attributes) {
|
|
12
|
+
for (const attribute in attributes) {
|
|
13
|
+
if (entity[attribute] === undefined || entity[attribute] === null) {
|
|
14
|
+
entity[attribute] = attributes[attribute];
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assign-default-values.js","sourceRoot":"","sources":["../src/assign-default-values.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"assign-default-values.js","sourceRoot":"","sources":["../src/assign-default-values.ts"],"names":[],"mappings":";;AAWA,kDAMC;AAbD;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAI,MAAS,EAAE,UAAuC;IACvF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;YAClE,MAAM,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC,SAAS,CAAwB,CAAC;QACnE,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@senhainfo/shared-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"repository": "https://github.com/senha-info/senha-shared-utils.git",
|
|
5
5
|
"author": "Bruno Gaspar <bruninhoogaspar@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,18 +13,22 @@
|
|
|
13
13
|
"types:check": "tsc --noEmit",
|
|
14
14
|
"clean": "rmdir /s /q lib",
|
|
15
15
|
"build": "npm run clean && tsc",
|
|
16
|
-
"prepare": "npm run build"
|
|
16
|
+
"prepare": "npm run build",
|
|
17
|
+
"commit:patch": "npm version patch --no-git-tag-version",
|
|
18
|
+
"commit:minor": "npm version minor --no-git-tag-version",
|
|
19
|
+
"commit:major": "npm version major --no-git-tag-version",
|
|
20
|
+
"postversion": "git add package.json && git commit -m v%npm_package_version%"
|
|
17
21
|
},
|
|
18
22
|
"publishConfig": {
|
|
19
23
|
"access": "public"
|
|
20
24
|
},
|
|
21
25
|
"devDependencies": {
|
|
22
|
-
"@types/node": "^22.
|
|
26
|
+
"@types/node": "^22.14.0",
|
|
23
27
|
"tsx": "^4.19.3",
|
|
24
|
-
"typescript": "^5.
|
|
28
|
+
"typescript": "^5.8.2"
|
|
25
29
|
},
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"axios": "^1.8.
|
|
31
|
+
"axios": "^1.8.4",
|
|
28
32
|
"date-fns": "^4.1.0"
|
|
29
33
|
}
|
|
30
34
|
}
|