Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Cache the response.
if (!Formio.ignoreCache && (method === 'GET')) {
Formio.cache[cacheKey] = _cloneDeep(result);
}
let resultCopy = {};
// Shallow copy result so modifications don't end up in cache
if (Array.isArray(result)) {
resultCopy = result.map(copy);
resultCopy.skip = result.skip;
resultCopy.limit = result.limit;
resultCopy.serverCount = result.serverCount;
}
else {
resultCopy = copy(result);
}
return resultCopy;
})
.catch((err) => {
return matches.map(method => {
const name = method.name
return copy(this.methodCache[name] = (
this.methodCache[name] || this.getMethodSuggestion(method)
))
})
}
function del(state, prop) {
const obj = copy(state.obj);
delete obj[prop];
state.obj = obj;
if (state.parent) {
update(state.parent, state.key, obj);
}
}
function update(state, prop, value) {
const obj = copy(state.obj);
obj[prop] = value;
state.obj = obj;
if (state.parent) {
update(state.parent, state.key, obj);
}
}
function update(state, prop, value) {
const obj = copy(state.obj);
obj[prop] = value;
state.obj = obj;
if (state.parent) {
update(state.parent, state.key, obj);
}
}