How to use the mnemonist/set.intersection function in mnemonist

To help you get started, we’ve selected a few mnemonist 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 hashicorp / consul / ui / packages / consul-ui / app / utils / filter / index.js View on Github external
return Object.keys(possibles).reduce((prev, key) => {
    // only set the value if the value has a length of > 0
    const value = typeof values[key] === 'undefined' ? [] : values[key];
    if (value.length > 0) {
      if (possibles[key] !== null) {
        // only include possible values
        prev[key] = [...setHelpers.intersection(possibles[key], new Set(value))];
      } else {
        // only unique values
        prev[key] = [...new Set(value)];
      }
    }
    return prev;
  }, {});
};

mnemonist

Curated collection of data structures for the JavaScript/TypeScript.

MIT
Latest version published 10 months ago

Package Health Score

76 / 100
Full package analysis