@itrocks/data-to-object 0.0.3 → 0.0.5
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/cjs/data-to-object.js +6 -1
- package/package.json +2 -2
package/cjs/data-to-object.js
CHANGED
|
@@ -7,7 +7,12 @@ const transformer_1 = require("@itrocks/transformer");
|
|
|
7
7
|
const transformer_2 = require("@itrocks/transformer");
|
|
8
8
|
async function dataToObject(object, data) {
|
|
9
9
|
const properties = new reflect_1.ReflectClass(object).propertyNames;
|
|
10
|
-
for (
|
|
10
|
+
for (let fieldName in data) {
|
|
11
|
+
if (fieldName.endsWith('_id')) {
|
|
12
|
+
fieldName = fieldName.slice(0, -3);
|
|
13
|
+
if (fieldName in data)
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
11
16
|
const propertyName = (0, rename_1.toProperty)(fieldName);
|
|
12
17
|
if (!properties.includes(propertyName))
|
|
13
18
|
continue;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"description": "Transforms raw string-based data into a business object with type-safe values",
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"typescript": "~5.
|
|
14
|
+
"typescript": "~5.8"
|
|
15
15
|
},
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=18"
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"build": "tsc"
|
|
53
53
|
},
|
|
54
54
|
"types": "./cjs/data-to-object.d.ts",
|
|
55
|
-
"version": "0.0.
|
|
55
|
+
"version": "0.0.5"
|
|
56
56
|
}
|