Skip to content

Instantly share code, notes, and snippets.

@suneo3476
Last active September 15, 2016 14:53
Show Gist options
  • Save suneo3476/d96cced3f9d84f4e7dd7a106dfc85143 to your computer and use it in GitHub Desktop.
Save suneo3476/d96cced3f9d84f4e7dd7a106dfc85143 to your computer and use it in GitHub Desktop.
test funcy.js for killing stich-case statement
'use strict'
//normal ver
const input0 = 0
const input1 = 1
let output
switch(input0){
case 0:
output = "あ"
break
default:
output = "うん"
break
}
console.log(output)
switch(input1){
case 0:
output = "あ"
break
default:
output = "うん"
break
}
console.log(output)
//funcy ver
const fun = require('funcy')
const $ = fun.parameter;
const func = fun(
[0,function(){return "あ"}],
[$,function(){return "うん"}]
)
console.log(func(0))
console.log(func(1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment