This function appears to be a general purpose utility function, not specific to the deck view. This should be put in a separate class/module that provides URL manipulation services. Actually, are there any JS libraries out there that do this already that we can reuse?