Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function cleanupFalcorKeys(obj) {
if (obj === null || (typeof obj) !== 'object' || obj.cleanupFalcorKeysMetaSeen) return obj;
const ret = {};
// In order to handle circular objects, the key name is convoluted to make sure it's unique
obj.cleanupFalcorKeysMetaSeen = true; // eslint-disable-line no-param-reassign
falcor.keys(obj).forEach(key => {
if (key === 'cleanupFalcorKeysMetaSeen') return;
ret[key] = cleanupFalcorKeys(obj[key]);
});
// Cleanup to not have mutated the object
delete obj.cleanupFalcorKeysMetaSeen; // eslint-disable-line no-param-reassign
return ret;
}
export function falcorValues(obj) {
return falcor.keys(obj).map(k => obj[k]);
};