@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
- interface AssignDefaultValuesProps<T> {
2
- entity: T;
3
- attributes: Array<{
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 {AssignDefaultValuesProps<T>} props
14
- * @param {T} props.entity - The entity to assign default values
15
- * @param {Array<{ [K in keyof T]: { name: K; value: T[K] } }[keyof T]>} props.attributes - The attributes to assign default values
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>({ entity, attributes }: AssignDefaultValuesProps<T>): void;
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,UAAU,wBAAwB,CAAC,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC;IACV,UAAU,EAAE,KAAK,CAAC;SAAG,CAAC,IAAI,MAAM,CAAC,GAAG;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;SAAE;KAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC1E;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,IAAI,CAMhG"}
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 {AssignDefaultValuesProps<T>} props
8
- * @param {T} props.entity - The entity to assign default values
9
- * @param {Array<{ [K in keyof T]: { name: K; value: T[K] } }[keyof T]>} props.attributes - The attributes to assign default values
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({ entity, attributes }) {
12
- for (const { name, value } of attributes) {
13
- if (entity[name] === undefined || entity[name] === null) {
14
- entity[name] = value;
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":";;AAYA,kDAMC;AAbD;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAI,EAAE,MAAM,EAAE,UAAU,EAA+B;IACxF,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,UAAU,EAAE,CAAC;QACzC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACxD,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC"}
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.9",
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.13.5",
26
+ "@types/node": "^22.14.0",
23
27
  "tsx": "^4.19.3",
24
- "typescript": "^5.7.3"
28
+ "typescript": "^5.8.2"
25
29
  },
26
30
  "dependencies": {
27
- "axios": "^1.8.1",
31
+ "axios": "^1.8.4",
28
32
  "date-fns": "^4.1.0"
29
33
  }
30
34
  }