Skip to content

Instantly share code, notes, and snippets.

@rupeshtiwari
Created June 22, 2017 02:16
Show Gist options
  • Save rupeshtiwari/c2316d1a1f282496d5d05228ff7d76f0 to your computer and use it in GitHub Desktop.
Save rupeshtiwari/c2316d1a1f282496d5d05228ff7d76f0 to your computer and use it in GitHub Desktop.
//-----COMPLETE_TODO------------
const stateBefore = {
todos: [{ text: 'testing', complete: false, path: ['todos', 0] }]
};
const stateAfter = {
todos: [{ text: 'testing', complete: true, path: ['todos', 0] }]
};
const result = over(lensPath(['todos',0, 'complete']), not, stateBefore);
console.log(result);
///---------ADD_TODO---------
const stateBefore = {
todos: [{ text: 'testing' }]
};
const stateAfter = {
todos: [{ text: 'testing', }, { text: 'testing1' }]
};
const result = over(lensPath(['todos']), (todos) => append({text:"testing1"}, todos), stateBefore);
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment