Skip to content

Instantly share code, notes, and snippets.

@skrat
Last active August 29, 2015 14:26
Show Gist options
  • Save skrat/7201f3a232874bf28eca to your computer and use it in GitHub Desktop.
Save skrat/7201f3a232874bf28eca to your computer and use it in GitHub Desktop.
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