Last active
August 29, 2015 14:26
-
-
Save skrat/7201f3a232874bf28eca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
macro @ { | |
case { _ $x } => { | |
letstx $sx = [makeValue(unwrapSyntax(#{$x}), #{here})]; | |
return #{ Symbol.for($sx) } | |
} | |
} | |
function todoApp(state, action) { | |
if (state === undefined) state = initialState; | |
switch (action.type) { | |
case @SET_VISIBILITY_FILTER: | |
return Object.assign({}, state, { | |
visibilityFilter: action.filter | |
}); | |
default: | |
return state; | |
} | |
} | |
// compiles to | |
function todoApp(state, action) { | |
if (state === undefined) | |
state = initialState; | |
switch (action.type) { | |
case Symbol.for('SET_VISIBILITY_FILTER'): | |
return Object.assign({}, state, { visibilityFilter: action.filter }); | |
default: | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment