function reorderMessageThreads() { $scope.hasMessages = messages.length > 0; $scope.messageThreads = _.chain(messages).orderBy(function(msg) { return msg.date; }) .groupBy(function(msg) { return msg.thread_id; }) .mapValues(function(messages) { return { last_date: messages[messages.length-1].date, messages: messages }; }) .value(); }
async function execute() { const allTasks = _.chain(require('./tasks')(functions)) .mapValues((obj, name) => { if (!target || re.test(name)) { return obj; } return _.pickBy(obj, (obj, name) => re.test(name) || re.test(_.first(name.split(':')))); }) .omitBy(_.isEmpty) .values() .value(); const result = {}; for (const obj of allTasks) { const config = { count: count || _.get(obj.config, ['count'], defaults.count), }; const map = _.omit(obj, 'config'); for (const [name, tasks] of Object.entries(map)) { const res = await executeTasks(config, tasks, name); if (res) { result[name] = res; } } } makeDoc && makeDocs(result); }
.mapValues(o => { if (o.length <= 1) return o[0]; else {
.mapValues(o => { if (o.length <= 1) return o[0]; else {