-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert.js
60 lines (54 loc) · 1.38 KB
/
convert.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
let target =
`
id: number;
accountId: number;
name: string;
cardId: string;
region: string;
phone: string;
bank: string;
`
function main () {
let arr = target.split(";");
let result = []
arr.forEach(ele => {
let index = ele.indexOf(":");
if (index == -1) {
return;
} else {
let key = ele.slice(1, index);
result.push(key);
console.log(`${key} <- obj .: "${key}"`)
}
});
console.log(`pure { ${result.join(', ')} }`)
}
main();
let moduleName = "Order"
let apis =
`
viewOrder :: m (Maybe (Array CommodityOrder))
payForOrder :: Slug -> m (Maybe CommodityOrder)
createOrderSpecial :: CreateOrderParams -> m (Maybe CommodityOrder)
payForOrderSpecial :: Slug -> m (Maybe CommodityOrder)
deleteOrder :: Slug -> m Unit
createACTSellCommission :: m (Maybe ACTSell)
createACTSellRebate :: m (Maybe ACTSell)
createOrder :: CreateOrderParams -> m (Maybe CommodityOrder)
`
function lift() {
console.log(`instance manage${moduleName}HalogenM :: Manage${moduleName} m => Manage${moduleName} (HalogenM s f g p o m) where`);
let arr = apis.split("\n");
let result = []
arr.forEach(ele => {
let index = ele.indexOf("::");
if (index == -1) {
return;
} else {
let after = ele.indexOf("->") != -1 ? "<<<" : "";
let key = ele.slice(0, index).trim();
console.log(`${key} = lift ${after} ${key}`)
}
});
}
// lift();