diff --git a/index.js b/index.js index b3a27bc..273db96 100644 --- a/index.js +++ b/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){