not-node 4.0.12 → 4.0.13
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/package.json +1 -1
- package/src/common.js +15 -0
- package/src/form/fabric.js +2 -2
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -92,6 +92,21 @@ module.exports.copyObj = (obj) => {
|
|
|
92
92
|
return JSON.parse(JSON.stringify(obj));
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Copies object to secure it from changes
|
|
97
|
+
* @param {object} obj original object
|
|
98
|
+
* @return {object} copy of object
|
|
99
|
+
**/
|
|
100
|
+
module.exports.partCopyObj = (obj, list) => {
|
|
101
|
+
let partObj = Object.keys(obj).reduce((prev, curr)=>{
|
|
102
|
+
if(list.includes(curr)){
|
|
103
|
+
prev[curr] = obj[curr];
|
|
104
|
+
}
|
|
105
|
+
return prev;
|
|
106
|
+
}, {});
|
|
107
|
+
return JSON.parse(JSON.stringify(partObj));
|
|
108
|
+
};
|
|
109
|
+
|
|
95
110
|
|
|
96
111
|
/**
|
|
97
112
|
* Test argument type to be 'function'
|
package/src/form/fabric.js
CHANGED
|
@@ -5,7 +5,7 @@ module.exports = class FormFabric {
|
|
|
5
5
|
FIELDS,
|
|
6
6
|
MODULE_NAME,
|
|
7
7
|
FORM_NAME,
|
|
8
|
-
|
|
8
|
+
extractor
|
|
9
9
|
}) {
|
|
10
10
|
return class extends Form {
|
|
11
11
|
constructor() {
|
|
@@ -21,7 +21,7 @@ module.exports = class FormFabric {
|
|
|
21
21
|
* @return {Object} forma data
|
|
22
22
|
**/
|
|
23
23
|
extract(req) {
|
|
24
|
-
return
|
|
24
|
+
return extractor(req);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
}
|