I'm worried this is buggy since on line 56 you go to lengths to call charCodeAt. I think I've commented on a similar bug before. Maybe you need to make these functions easier to use? (For example, you could make the helper function use typeof and handle either strings or numbers. It might be worth adding a sanity assertion that those strings are 1 char long.)