Last active
June 6, 2023 19:28
-
-
Save jcsalterego/bdf5f5f163170c3b98841e61586f7c46 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
function hasDotNet(text) { | |
return text.match(/.NET|[\s^]\.net/) !== null; | |
} | |
function test(expected, text) { | |
let rv = hasDotNet(text); | |
if (expected !== rv) { | |
console.log(`expected ${expected}, but got ${rv} = ${text}`); | |
} else { | |
console.log(`✅ ${rv} = ${text}`); | |
} | |
} | |
test(true, "i love .net"); | |
test(true, "i love .NET"); | |
test(false, "i dislike viruses.net"); |
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
node dotnet.js | |
✅ true = i love .net | |
✅ true = i love .NET | |
✅ false = i dislike viruses.net |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment