Port of some underscore-js functions for ui.