-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsonObject.js
44 lines (40 loc) · 956 Bytes
/
jsonObject.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
let subObjectName2 = {
"keyName3": {
"mandatory": "1"
, "newKeyName": "newKeyMan"
, "valueValidity" : {
"validValueType" : ["number","stringNumber"]
}
}
};
let objectMap = {
"keyName1": {
"mandatory": "1"
, "newKeyName": "newKeyName1"
, "valueValidity": {
"validValueType": ["string","stringNumber"]
}
}
, "keyName2": {
"mandatory": "0"
, "subObject": {
"ObjectRef": subObjectName2
, "isObjectArray": 1
, "minLenArray" : 1
, "maxLenArray" : 3
}
}
};
var omv = require("./object_mapper_validator");
let obj = {
keyName1: "1"
, keyName2: [{
"keyName3" : "-1.232"
},{
"keyName3" : "-1.232"
},{
"keyName3" : "-1.232"
}]
};
var objn = omv.mapAndValidate(obj, objectMap);
console.log("Resultant Object : ", JSON.stringify(objn));