I would go for a lib.js and make a method there. The background behind it is, that you can't really test the function. Since I plan on writing tests for the main functions when I find the time.