Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isMatchCredentialMeta = (credentialMeta, constraintsMeta) => {
const metaConstrait = transformMetaConstraint(constraintsMeta);
let result = false;
if (!_.isEmpty(metaConstrait)) {
result = sift.indexOf(metaConstrait, [credentialMeta]) > -1;
}
return result;
};
function setRequestData(request, params, data) {
const collection = storage[request.collection] || [];
let newState;
if (request.params.$id) {
const i = sift.indexOf(params, collection);
if (i > -1) {
newState = update(collection, {$splice: [request.type === 'DELETE' ? [i, 1] : [i, 1, data]]});
} else if (request.type !== 'DELETE') {
newState = update(collection, {$push: [data]});
}
} else if (Array.isArray(data)) {
newState = update(collection, {$push: data.filter(item => sift.indexOf({$id: item[idProperty]}, collection) < 0)});
} else {
newState = update(collection, {$push: [data]});
}
if (newState) {
setState({[request.collection]: newState});
}
return data;
}
const isMatchCredentialMeta = (credentialMeta, constraintsMeta) => {
const metaConstrait = transformMetaConstraint(constraintsMeta);
let result = false;
if (!_.isEmpty(metaConstrait)) {
result = sift.indexOf(metaConstrait, [credentialMeta]) > -1;
}
return result;
};
_.forEach(siftConstraints, constraint => {
result = sift.indexOf(constraint, [this.claim]) > -1;
return result;
});
return result;
newState = update(collection, {$push: data.filter(item => sift.indexOf({$id: item[idProperty]}, collection) < 0)});
} else {
_.forEach(siftConstraints, constraint => {
result = sift.indexOf(constraint, [this.claim]) > -1;
return result;
});
return result;
_.forEach(siftConstraints, (constraint) => {
result = (sift.indexOf(constraint, [credentialMeta]) > -1) && result;
});
return result;