flatMap(toUpsert, (doc) => [ { update: { _index: doc.index, _id: doc.id, _type: doc.type } }, { doc: doc.body, doc_as_upsert: true } ])
async _createNestedFiles() { await Promise.all( flatMap(this._folders, this._createNestedFilesIn.bind(this)) ); }
const convertToLinesOfEdits = (linesOfDiffs, startLineNumber) => flatMap( linesOfDiffs, (diffs, i) => diffsToEdits(diffs, startLineNumber + i) )
callback(flatMap(results)); });
flatMap(Object.keys(this.metrics), function (protocol) { return Object.keys(self.metrics[protocol]).map(function (hostName) { var host = self.metrics[protocol][hostName] return { protocol: protocol, target: { id: hostName }, metrics: { responseTime: self.calculateTimes(host.responseTime), status: { ok: host.status.ok, notOk: host.status.notOk } } } }) })
const groupChanges = hunks => { const changes = flatMap(hunks, hunk => hunk.changes); return changes.reduce( ([oldChanges, newChanges], change) => { if (change.isNormal) { oldChanges.push(change); newChanges.push(change); } else if (change.isDelete) { oldChanges.push(change); } else { newChanges.push(change); } return [oldChanges, newChanges]; }, [[], []] ); }
const markInPaths = (word, name, replacement) => paths => flatMap( paths, path => { const leaf = last(path); if (!leaf.value.includes(word)) { return [path]; } const segments = leaf.value.split(word); return segments.reduce( (output, text, i) => { if (i !== 0) { output.push(replace(path, {type: 'mark', markType: name, value: replacement})); } if (text) { output.push(replace(path, {...leaf, value: text})); } return output; }, [] ); } )
const findAbnormalChanges = hunks => flatMap(hunks, hunk => hunk.changes.filter(change => !change.isNormal))
flatMap(Object.keys(this.metrics), function (protocol) { return Object.keys(self.metrics[protocol]).map(function (serviceKey) { var items = self.metrics[protocol][serviceKey] if (serviceKey === 'root') { return { protocol: protocol, metrics: { count: items.count } } } else { return { protocol: protocol, serviceKey: serviceKey, metrics: { transportDelay: self._calculateTimes(items.transportDelay), count: items.count } } } }) })
flatMap(Object.keys(instrumentedCommands), function (key) { return instrumentedCommands[key] })
flatMap(hunks.map(hunk => hunk.changes), findChangeBlocks)
flatMap(toRemove, (doc) => [{ delete: { _index: doc.index, _id: doc.id } }])
async _createNestedFiles() { await Promise.all( flatMap(this._folders, this._createNestedFilesIn.bind(this)) ); }
flatMap(Object.keys(redisCommands), function (key) { return redisCommands[key] })
flatMap(Object.keys(redisCommands), function (key) { return redisCommands[key] })