falcor-router
Version:
A router DataSource constructor for falcor that allows you to model all your cloud data sources as a single JSON resource.
15 lines (14 loc) • 387 B
JavaScript
/**
* To simplify this algorithm, the path must be a simple
* path with no complex keys.
*
* Note: The path coming in must contain no references, as
* all set data caches have no references.
* @param {Object} cache
* @param {PathSet} path
*/
module.exports = function getValue(cache, path) {
return path.reduce(function(acc, key) {
return acc[key];
}, cache);
};