Make flatten function a variable to avoid strict mode errors.

I was trying to use highlight.js in an environment that has strict mode on and kept getting this error: In strict mode code, functions can only be declared at top level or immediately within another function. It took a bit of digging, but I found the `flatten` function being defined part way through another function. Moving the function to the top of the parent function resolves the issue, but I didn't want to move it outside of its current condition. Making it a variable worked just as well and allows it to remain where it is.