-
Notifications
You must be signed in to change notification settings - Fork 50
/
.hygen.js
38 lines (38 loc) · 1.29 KB
/
.hygen.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
module.exports = {
helpers: {
/**
* Converts the Flutter config type to an Android type extracted from decoding JSON.
* @param config Flutter config type
* @returns {*|string} Android config type from JSON; returns given param if no match is found
*/
getJavaConfigValue: config => {
let dict = {
"bool" : "boolean",
"List" : "JSONArray",
"Map" : "JSONObject"
};
for (const [key, value] of Object.entries(dict)) {
if (config.includes(key))
return value;
}
return config
},
/**
* Converts the Flutter config type to an iOS type extracted from decoding JSON.
* @param config iOS config type
* @returns {*|string} iOS config type from JSON; returns given param if no match is found
*/
getIOSConfigValue: config => {
let dict = {
"bool" : "NSNumber",
"List" : "NSArray",
"Map" : "NSDictionary"
};
for (const [key, value] of Object.entries(dict)) {
if (config.includes(key))
return value;
}
return config
},
}
}