Last active
December 16, 2015 18:59
-
-
Save manuelcabral/5481760 to your computer and use it in GitHub Desktop.
Switch inside object literal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param = 'foo' | |
someObject = | |
someKey: 'some value' | |
someOtherKey: switch param | |
when 'foo' then "something" | |
when 'bar' then "something else" | |
when 'fooo' then "something different" | |
else "some other thing" | |
console.log(someObject.someOtherKey) | |
#>something |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment