The implementation of navigate on the time of this writing looks like so:
navigate: function (method) {
var methods = {
// ...
},
Hence every time we call navigate to generate urls:
The 'methods' object is generated again and again. This introduces an unnecessary overhead.
The solution: Refactor the implementation to move the 'methods' object outside of 'navigate()'.