From acc9c8d8fd55df3cc908f86dc7deb2c5ca682e93 Mon Sep 17 00:00:00 2001 From: Yuya Date: Thu, 22 Mar 2018 20:05:18 -0400 Subject: [PATCH] Support Japanese kana scripts --- README.md | 2 ++ five.js | 8 +++++++- test.js | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index addc66f6..2e17cd0c 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ five.indonesian() // lima five.irish() // cúig five.italian() // cinque five.japanese() // 五 +five.japanese('hiragana') // ご +five.japanese('katakana') // ゴ five.kannada() // ಐದು five.klingon() // vagh five.korean() // 오 diff --git a/five.js b/five.js index 90507e66..ba593c10 100755 --- a/five.js +++ b/five.js @@ -62,7 +62,13 @@ five.indonesian = function() { return 'lima'; }; five.irish = function() { return 'cúig'; }; five.italian = function() { return 'cinque'; }; - five.japanese = function() { return '五'; }; + five.japanese = function(type) { + switch(type) { + case 'hiragana': return 'ご'; + case 'katakana': return 'ゴ'; + default: return '五'; + } + }; five.kannada = function() { return 'ಐದು'; }; five.klingon = function() { return 'vagh'; }; five.korean = function() { return '오'; }; diff --git a/test.js b/test.js index 63ee6cc8..797d7f6b 100755 --- a/test.js +++ b/test.js @@ -49,6 +49,8 @@ assert.equal('lima', five.indonesian(), 'A indonesian five should be lima'); assert.equal('cúig', five.irish(), 'A irish five should be cúig'); assert.equal('cinque', five.italian(), 'A italian five should be cinque'); assert.equal('五', five.japanese(), 'A japanese five should be 五'); +assert.equal('ご', five.japanese('hiragana'), 'A japanese five in hiragana should be ご'); +assert.equal('ゴ', five.japanese('katakana'), 'A japanese five in katakana should be ゴ'); assert.equal('ಐದು', five.kannada(), 'A kannada five should be ಐದು'); assert.equal('vagh', five.klingon(), 'A klingon five should be vagh'); assert.equal('오', five.korean(), 'A korean five should be 오');