Last active
September 9, 2018 22:43
-
-
Save friendlyanon/9e3f46f97bb9b78bd021b6bd2571d6de 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 isIsogram(s) { | |
var map, str, c, i, l, e, h; | |
if (typeof s !== "string") return false; | |
if ((l = s.length) < 2) return true; | |
c = (str = s.toLowerCase()).codePointAt(); | |
if ((h = c > 0xFFFF) && l < 4) return true; | |
(map = {})[c] = true, e = l - 2, i = +h; | |
do { | |
if (map[c = str.codePointAt(++i)]) return false; | |
if (c > 0xFFFF) if (i === e) return true; else ++i; | |
map[c] = true; | |
} while (i < l); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment