Skip to content

Commit

Permalink
Merge pull request #8 from jerrychong25/dev
Browse files Browse the repository at this point in the history
Added getStates() languages options (en, ms & zh)
  • Loading branch information
jerrychong25 authored Feb 16, 2020
2 parents 3ec864b + 47c578f commit b41b1e1
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 b41b1e1

Please sign in to comment.