How to use the sift 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 QurateInc / vue-pouch-db / src / utils / index.js View on Github external
get: function getterComputedQueries() {
          // If dbsetup does not exist, throw Error!
          if (!this.$dbsetup) throw new Error('[VuePouchDB] dbsetup does not exist!');
          // Setting up the Queries
          // TODO: memoize/cache this function
          return (this.$bucket.state[this.$dbsetup.name] || []).filter(
            sift(expand(queries[name], this) || {})
          );
        },
        // When setting wait 500ms before executing the function
github redgeoff / mson-react / src / mson / component / validator.js View on Github external
_validateWithRule(rule) {
    // Clone where as we will be modifying the leaf nodes
    let where = _.cloneDeep(rule.where);

    // Fill the props
    this._fillWhere(where);

    // Validation failed?
    let sifted = sift(where, [this._props]);
    if (sifted.length > 0) {
      return this._fillErrorProps(rule.error);
    }
  }
github gadicc / gongo / gongo-client / src / gongo.js View on Github external
constructor(collection, query, options) {
    this.collection = collection;

    if (!query)
      query = {};
    if (!options)
      options = {};

    if (!options.includePendingDeletes)
      query.__pendingDelete = { $exists: false };

    this._query = query;
    this.query = sift(query);
  }
github cult-of-coders / grapher / lib / query / hypernova / aggregateSearchFilters.js View on Github external
eligibleObjects = _.filter(this.parentObjects, object => {
                    return sift(this.metaFilters)(object[this.linkStorageField]);
                });
            }
github gadicc / gongo / gongo-client / src / gongo.js View on Github external
update(idOrSelector, newDocOrChanges) {
    if (typeof idOrSelector === 'string') {

      return this._update(idOrSelector, newDocOrChanges);

    } else if (typeof idOrSelector === 'object') {

      const query = sift(idOrSelector);

      const updatedDocIds = [];
      let matchedCount = 0;
      let modifiedCount = 0;

      for (let [id, doc] of this.documents)
        if (query(doc)) {
          matchedCount++;
          if (this._update(id, newDocOrChanges)) {
            modifiedCount++;
            updatedDocIds.push(id);
          };
        }
      return {
        matchedCount,
        modifiedCount,
github stalniy / casl / packages / casl-ability / index.js View on Github external
function Rule(params) {
    classCallCheck(this, Rule);

    this.conditions = params.conditions;
    this.actions = params.actions;
    this.subject = params.subject;
    this.inverted = !!params.inverted;
    this._matches = this.conditions ? sift(this.conditions) : null;
  }
github joakimbeng / relae / src / store.js View on Github external
function getRequestData(request, params) {
  const collection = storage[request.collection] || [];
  let data = sift(params, collection);
  if (request.params.$id) {
    return data && data[0];
  }
  if (params.$skip || params.$limit) {
    const skip = params.$skip || 0;
    const limit = params.$limit ? skip + params.$limit : null;
    data = data.slice(skip, limit);
  }
  return data;
}
github apiaryio / attributes-kit / src / Components / ObjectProperties / ObjectProperties.js View on Github external
type: 'included',
    };

    const inheritedPropertiesQuery = {
      type: 'inherited',
    };

    const ownOrIncludedGroupsQuery = {
      $or: [
        ownPropertiesQuery,
        includedPropertiesQuery,
      ],
    };

    const ownProperties = sift(ownPropertiesQuery, elementGroups);
    const inheritedProperties = sift(inheritedPropertiesQuery, elementGroups);
    const includedProperties = sift(includedPropertiesQuery, elementGroups);

    const ownOrIncludedProperties = sift(ownOrIncludedGroupsQuery, elementGroups);

    if (this.context.inheritedProperties === 'placeholder' &&
      this.context.includedProperties === 'placeholder') {
      return (
        <div style="{this.style.root}">
          {
            map(inheritedProperties, (group, groupIndex) =&gt; (
              
                {
                  group.components
                }
              
            ))</div>
github cult-of-coders / grapher / lib / links / lib / createSearchFilters.js View on Github external
export function createManyMeta(object, fieldStorage, metaFilters) {
    let value = object[fieldStorage];

    if (metaFilters) {
        value = sift(metaFilters, value)
    }

    return {
        _id: {
            $in: _.pluck(value, '_id') || []
        }
    };
}

sift

MongoDB query filtering in JavaScript

MIT
Latest version published 20 days ago

Package Health Score

89 / 100
Full package analysis