Last active
May 6, 2018 21:30
-
-
Save ryanluker/ebd89e7e6f6f9bb2102e656c84bcc4d7 to your computer and use it in GitHub Desktop.
example
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 a = [...base].reverse(); | |
const b = [...comparee].reverse(); | |
// find the intersection and reverse it back into a string | |
const intersection = [...a].filter((x, i) => x === b[i]).reverse().join(""); | |
// prevent file names from returning true, the intersection must include ###'s | |
// from the normalize process | |
if (!intersection.includes("###")) return false; | |
// if the whole word intersection is present in base, return true | |
return base.includes(intersection); | |
/** | |
tests: | |
1) "c:###dev###vscode-coverage-gutters###example###node###test-coverage.js" | |
1) "###home###ryanluker###dev###vscode-coverage-gutters###example###node###test-coverage.js" | |
2) "c:###dev###vscode-coverage-gutters###example###node###test.js" | |
2) "###home###ryanluker###dev###vscode-coverage-gutters###example###node###test.js" | |
3) "c:###dev###vscode-coverage-gutters###example###node###test.js" | |
3) "###home###ryanluker###dev###vscode-coverage-gutters###example###node###test-coverage.js" | |
3) "ve-###.js" | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment