improve randomSecword to accept zhCN, enUS, ... as lang
This commit is contained in:
parent
5a378f4daa
commit
53b0c4a6c0
7
index.js
7
index.js
@ -324,9 +324,10 @@ module.exports = {
|
||||
return null
|
||||
}
|
||||
,
|
||||
randomSecword:function(lang){ // Object.keys(Secword.Words) => [ 'CHINESE', 'ENGLISH', 'FRENCH', 'ITALIAN', 'JAPANESE', 'SPANISH' ]
|
||||
lang = (lang && Secword.Words.hasOwnProperty(lang.toUpperCase())) ? lang.toUpperCase() : 'ENGLISH'
|
||||
return new Secword(Secword.Words[lang]).phrase
|
||||
randomSecword:function(lang='ENGLISH'){ // Object.keys(Secword.Words) => [ 'CHINESE', 'ENGLISH', 'FRENCH', 'ITALIAN', 'JAPANESE', 'SPANISH' ]
|
||||
let language = { zhCN: 'CHINESE', enUS: 'ENGLISH', frFR: 'FRENCH', itIT: 'ITALIAN', jaJP: 'JAPANESE', esES: 'SPANISH' }[lang]
|
||||
|| (Secword.Words.hasOwnProperty(lang.toUpperCase()) ? lang.toUpperCase() : 'ENGLISH')
|
||||
return new Secword(Secword.Words[language]).phrase
|
||||
}
|
||||
,
|
||||
randomSeckey:function(option){
|
||||
|
Loading…
Reference in New Issue
Block a user