Can you move this to utils: https://github.com/code-dot-org/blockly-core/blob/master/core/utils.js#L435