Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import update from 'react/lib/update';
import sift from 'sift';
import eventEmitter from 'event-emitter';
let idProperty = 'id';
sift.useOperator('id', (a, b) => a === b[idProperty]);
sift.useOperator('limit', () => true);
sift.useOperator('skip', () => true);
const ee = eventEmitter();
let storage = {};
function setState(state) {
storage = update(storage, {$merge: state});
Object.keys(state).forEach(key => ee.emit('change', key));
}
function getRequestData(request, params) {
const collection = storage[request.collection] || [];
let data = sift(params, collection);
if (request.params.$id) {
import update from 'react/lib/update';
import sift from 'sift';
import eventEmitter from 'event-emitter';
let idProperty = 'id';
sift.useOperator('id', (a, b) => a === b[idProperty]);
sift.useOperator('limit', () => true);
sift.useOperator('skip', () => true);
const ee = eventEmitter();
let storage = {};
function setState(state) {
storage = update(storage, {$merge: state});
Object.keys(state).forEach(key => ee.emit('change', key));
}
function getRequestData(request, params) {
const collection = storage[request.collection] || [];
let data = sift(params, collection);
if (request.params.$id) {
return data && data[0];
import update from 'react/lib/update';
import sift from 'sift';
import eventEmitter from 'event-emitter';
let idProperty = 'id';
sift.useOperator('id', (a, b) => a === b[idProperty]);
sift.useOperator('limit', () => true);
sift.useOperator('skip', () => true);
const ee = eventEmitter();
let storage = {};
function setState(state) {
storage = update(storage, {$merge: state});
Object.keys(state).forEach(key => ee.emit('change', key));
}
function getRequestData(request, params) {
const collection = storage[request.collection] || [];
let data = sift(params, collection);
if (request.params.$id) {
return data && data[0];
}