Refactoring folding in javascript to better work with rainbow parentheses.