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
const state = { | |
people: { | |
1: { id: 1, name: 'one' }, | |
2: { id: 2, name: 'two' }, | |
3: { id: 3, name: 'three' }, | |
}, | |
likes: { | |
1: [2, 3], | |
2: [1], | |
3: [1], |
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
const REMOVE = () => REMOVE; | |
const get = (object, path, defaultValue) => { | |
const recur = (current, path, defaultValue) => { | |
if (current === undefined) { | |
return defaultValue; | |
} | |
if (path.length === 0) { | |
return current; | |
} | |
return recur( |
NewerOlder