falcor
Version:
A JavaScript library for efficient data fetching.
32 lines (26 loc) • 715 B
JavaScript
;
function falcor(opts) {
return new falcor.Model(opts);
}
/**
* A filtering method for keys from a falcor json response. The only gotcha
* to this method is when the incoming json is undefined, then undefined will
* be returned.
*
* @public
* @param {Object} json - The json response from a falcor model.
* @returns {Array} - the keys that are in the model response minus the deref
* _private_ meta data.
*/
falcor.keys = function getJSONKeys(json) {
if (!json) {
return undefined;
}
return Object.
keys(json).
filter(function(key) {
return key !== "$__path";
});
};
module.exports = falcor;
falcor.Model = require("./Model");