Created
July 29, 2017 21:45
-
-
Save chronick/7f4c949c039dcc87f73444616b670c45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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