Utilities for Javascript plug

The underscore goes at the end for dodging keywords: http://legacy.python.org/dev/peps/pep-0008/#descriptive-naming-styles. But `type` isn't strictly a keyword, and you won't be needing the `type` builtin in this scope, so you could just go ahead and use the name `type`.