helper function for ceylon/ceylon-js#379