keywords-match ![Build Status](https://camo.githubusercontent.com/d845f31781265f0864fb647a8fe1f2baf1d8a1cae676dab5eb61dd00ec486b9a/68747470733a2f2f7472617669732d63692e6f72672f446150756c73652f6b6579776f7264732d6d617463682e7376673f6272616e63683d6d6173746572)
Try it out on CodeSandBox
const matcher = require('keywords-matcher');
const collection = ['cat', 'lion', 'sandcat', 'catfish'];
const expression = 'cat -fish';
const result = matcher(expression, collection);
console.log(result); // ['cat', 'sandcat']
- ' ' (space) - Means both expressions are required
- '|' (pipeline) - Means at least one expression is required
- '-' (dash) - Means the following expression must not be met
- expression - The filtered string contains the expression
- '""' (quotes) - Means the expression is matched exactly