startIndex defaults to -1, which in Chrome results in returning -1 regardless of the other parameters. Added regression tests.
Translate AtScript in test/facade to TypeScript