How to use the sift.indexOf function in sift

To help you get started, we’ve selected a few sift examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github identity-com / credential-commons / dist / es / creds / VerifiableCredential.js View on Github external
const isMatchCredentialMeta = (credentialMeta, constraintsMeta) => {
  const metaConstrait = transformMetaConstraint(constraintsMeta);
  let result = false;
  if (!_.isEmpty(metaConstrait)) {
    result = sift.indexOf(metaConstrait, [credentialMeta]) > -1;
  }
  return result;
};
github joakimbeng / relae / src / store.js View on Github external
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;
}
github identity-com / credential-commons / dist / cjs / creds / VerifiableCredential.js View on Github external
const isMatchCredentialMeta = (credentialMeta, constraintsMeta) => {
  const metaConstrait = transformMetaConstraint(constraintsMeta);
  let result = false;
  if (!_.isEmpty(metaConstrait)) {
    result = sift.indexOf(metaConstrait, [credentialMeta]) > -1;
  }
  return result;
};
github identity-com / credential-commons / dist / cjs / creds / VerifiableCredential.js View on Github external
_.forEach(siftConstraints, constraint => {
      result = sift.indexOf(constraint, [this.claim]) > -1;
      return result;
    });
    return result;
github joakimbeng / relae / src / store.js View on Github external
    newState = update(collection, {$push: data.filter(item => sift.indexOf({$id: item[idProperty]}, collection) < 0)});
  } else {
github identity-com / credential-commons / dist / es / creds / VerifiableCredential.js View on Github external
_.forEach(siftConstraints, constraint => {
      result = sift.indexOf(constraint, [this.claim]) > -1;
      return result;
    });
    return result;
github identity-com / credential-commons / src / creds / VerifiableCredential.js View on Github external
_.forEach(siftConstraints, (constraint) => {
    result = (sift.indexOf(constraint, [credentialMeta]) > -1) && result;
  });
  return result;

sift

MongoDB query filtering in JavaScript

MIT
Latest version published 8 months ago

Package Health Score

77 / 100
Full package analysis