the easiest way would probably be to write a helper function and use that in both places. (and to write a jasmine test for that new helper function)
;)