Skip to content

Instantly share code, notes, and snippets.

@xnuk
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save xnuk/fbba6bcb121599fb7369 to your computer and use it in GitHub Desktop.

Select an option

Save xnuk/fbba6bcb121599fb7369 to your computer and use it in GitHub Desktop.
일을 하자
(function(){
function switchreturn(compare, a){
for(var i in a.case)
if(a.case[i][0].indexOf(compare)>-1)return a.case[i][1]
return a.default
}
var one=function(){return 1}
one.toString=function(a){
if(a==null || typeof a==='number' || (typeof a==='string' && (+a)+''!=='NaN') || typeof a!=='string')return '1'
a=a.toLowerCase()
return switchreturn(a.toLowerCase(), {
'case':[
[['ko', 'kor', 'korean'], '일'],
[['ja', 'jpn', 'japanese', 'zh', 'chi', 'zho', 'chinese'], '一'],
[['en', 'eng', 'english'], 'one']
],
'default':'1'
})
}
one.stretch=function(){return '일이 늘어났다'}
one.increase=function(){return '일이 너무 많아졌다'}
one.decrease=function(){return '일이 줄어들지 않는다'}
module.exports=one
})(module)
@yous
Copy link

yous commented Aug 5, 2014

case 'english': return 'one'
case 'chinese': return '一'
case 'japanese': return '一'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment