@duet3d/objectmodel 3.4.0-b2 → 3.4.0-b3
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/ModelObject.js +13 -0
- package/package.json +1 -1
package/dist/ModelObject.js
CHANGED
|
@@ -153,3 +153,16 @@ class ModelObject {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
exports.default = ModelObject;
|
|
156
|
+
/**
|
|
157
|
+
* Initialize a class item from the given data
|
|
158
|
+
* @param itemType Item type to create
|
|
159
|
+
* @param data Data to assign
|
|
160
|
+
* @returns Initialized item instance
|
|
161
|
+
*/
|
|
162
|
+
function initItem(itemType, data) {
|
|
163
|
+
const result = new itemType();
|
|
164
|
+
for (let key in data) {
|
|
165
|
+
result[key] = data[key];
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|