JavaScript: library boilerplate