Skip to content

Instantly share code, notes, and snippets.

@chronick
Created July 29, 2017 21:45
Show Gist options
  • Save chronick/7f4c949c039dcc87f73444616b670c45 to your computer and use it in GitHub Desktop.
Save chronick/7f4c949c039dcc87f73444616b670c45 to your computer and use it in GitHub Desktop.
const testFuzzy: Test = compare => {
// Creates a regex that allows for any number of characters between those
// passed. Similar to Sublime Text's cmd-p menu. 'i' for case insensitive.
const regex = new RegExp(compare.split("").join(".*"), "i");
return (obj, key) => regex.test(obj[key]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment