An algorithm for guessing tabs/spaces, tab size, and line endings, implemented in JavaScript