-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
51 lines (44 loc) · 874 Bytes
/
index.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
let cities = require('./data/cities.min')
let regions = require('./data/regions.min')
let app = {}
app.getCities = (regionId) => {
let c = cities.filter((city) => {
return city.region_id == regionId
})
return c.map(({ name_mm, name_en, id }) => {
return {
id,
name_mm: name_mm,
name_en: name_en,
}
})
}
app.getRegions = () => {
return regions
}
app.getAllCities = () => {
return cities
}
app.getCitiesMM = (regionId) => {
let c = cities.filter((city) => {
return city.region_id == regionId
})
return c.map(({ name_mm, id }) => {
return {
id,
name: name_mm,
}
})
}
app.getCitiesEN = (regionId) => {
let c = cities.filter((city) => {
return city.region_id == regionId
})
return c.map(({ name_en, id }) => {
return {
id,
name: name_en,
}
})
}
module.exports = app