Skip to content

Commit

Permalink
Added getStates() languages option (en, ms, zh)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrychong25 committed Feb 16, 2020
1 parent 1ed86d9 commit 47c578f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 17 deletions.
57 changes: 41 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,46 @@ module.exports = (str) => {
}

module.exports.getStates = (language) => {
return {
states: [
'Johor Darul Ta\'zim',
'Kedah Darul Aman',
'Kelantan Darul Naim',
'Malacca',
'Negeri Sembilan Darul Khusus',
'Pahang Darul Makmur',
'Penang',
'Perak Darul Ridzuan',
'Perlis Indera Kayangan',
'Sabah',
'Sarawak',
'Selangor Darul Ehsan',
'Terengganu Darul Iman'
]

let statesList

if (language === 'en' | language === 'ms') {
statesList = {
states: [
'Johor Darul Ta\'zim',
'Kedah Darul Aman',
'Kelantan Darul Naim',
'Malacca',
'Negeri Sembilan Darul Khusus',
'Pahang Darul Makmur',
'Penang',
'Perak Darul Ridzuan',
'Perlis Indera Kayangan',
'Sabah',
'Sarawak',
'Selangor Darul Ehsan',
'Terengganu Darul Iman'
]
}
} else if (language === 'zh') {
statesList = {
states: [
'柔佛',
'吉打',
'吉兰丹',
'马六甲',
'森美兰',
'彭亨',
'槟城',
'霹雳',
'玻璃市',
'沙巴',
'砂拉越',
'雪兰莪',
'登嘉楼'
]
}
}

return statesList
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "malaysia-list",
"version": "0.0.2",
"version": "0.0.3",
"description": "This package will display all lists related to Malaysia",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 47c578f

Please sign in to comment.