We have a helper utilitly method on common for this: https://github.com/guardian/frontend/blob/master/common/app/assets/javascripts/common.js#L51