Message from JavaScript discussions

February 2019

— ?

— 

const swotch = (def, obj) =>
x =>
obj[x] || def;

const strats = swotch(false, {
NotStarted: false,
InProgress: false,
Completed: true
});

strats('InProgress') // false
strats('Completed') // true
strats('Unknown') // false


And now you realize you can just do:

const strats = x =>
x === 'Completed';

— Too complicated🤤 also slow in terms of a speed freak

— Count the number of entites/vars youve created

— I found 5

— 

swotch = do ->
strats =
NotStarted: false
InProgress: false
Completed: true
return (x) ->
return starts[x]

Message permanent page

— Hey there is a bug there🤤 you have to use .hasOwnProp to make it *ideal*

— No bug lol

— I don't care about falsy values

— All your intent was to generalize generalizer, right

— I better meditate

— Https://twitch.tv/rubytrue