Promise .all([ queryCollaborators({ repositoryOwner, repositoryName }), queryCommits({ repositoryOwner, repositoryName, since }) ]) .then(results => { const collaborators = _.keyBy(results[0], 'login') return _.chain(results[1]) .map('author.user') .reject(_.isEmpty) .groupBy('login') .map(group => _.defaults({ commits: _.size(group) }, _.head(group))) .filter(user => _.isEmpty(collaborators[user.login])) .value() }) .then(res => formatOutput(res)) .catch(err => console.log(err))
_.chain(data) .map(aggregateData) .groupBy(aggData, function(singleRecord) { return singleRecord.Timestamp }) .sortBy('Timestamp') .value()
var getVA = function (words, join_words) { var tfidf = new TfIdf () tfidf.addDocument(words.join(' ')) var result = _.chain(join_words) .map(function (word) { return tfidf.tfidfs(word, function(i, measure) { return measure })[0] }) .value() return result }
Promise.all(semesters.map(function (semester) { return self.__getSemesterCourses__(semester); } )).then(function (coursesArray) { return _.chain(coursesArray).flatten().uniq(function (course) { return course.id; }).value(); }, function (err) { return self.__getAllCoursesOffline__(); })
_.chain(sentences) .map(function (sentence) { var a = Processor.prototype.lambda1 * sentence['word_form_similarity'] var b = Processor.prototype.lambda2 * sentence['word_semantic_similarity'] var c = Processor.prototype.lambda3 * sentence['word_order_similarity'] sentence['total_score'] = a + b + c return sentence }) .value()
_.chain(db) .filter(a => _.includes(_.lowerCase(a.name), _.lowerCase(criteria.name))) .filter(a => a.age > criteria.age.min && a.age < criteria.age.max) .filter(a => a.yearsActive > criteria.yearsActive.min && a.yearsActive < criteria.yearsActive.max) .sortBy(a => a[sortProperty]) .value()
_.chain(best_sentences) .sortBy(function(a) { return a['s_id'] }) .map('text') .value() .join(' ')
var getVB = function (words, join_words) { var words_bigram = getBigram(words) var join_words_bigram = getBigram(join_words) var result = _.chain(join_words_bigram) .map(function (word) { return (_.includes(words_bigram, word)) ? 1 : 0}) .value() return result }
/** * Parse a rank result from redis * @param {array} rank In this format: [ 'foo', '39', 'bar', '13' ] * @return {object} In this format: [ { foo: 39 }, { bar: 13 } ] * @private */ const rankParser = rank => { return _.chain(rank) .chunk(2) .map(([key, count]) => ({ [key]: Number(count) })) .value(); }
_.chain(suffix) .map(function (s) { var suffix = s var result = '' var limit = word.length-suffix.length if (word.lastIndexOf(suffix) == limit) result = word.substring(0, limit) return result }) .filter(function (c) { return c !== '' }) .filter(function (c) { return Word.prototype.isBasicWord(c) }) .value()
var getVC = function (words, join_words) { var words_trigram = getTrigram(words) var join_words_trigram = getTrigram(join_words) var result = _.chain(join_words_trigram) .map(function (word) { return (_.includes(words_trigram, word)) ? 1 : 0}) .value() return result }
_.chain(sentences) .map(function (sentence) { delete sentence['words'] return sentence }) .value()
Promise .all([ queryCollaborators({ repositoryOwner, repositoryName }), queryCommits({ repositoryOwner, repositoryName, since }) ]) .then(results => { const collaborators = _.keyBy(results[0], 'login') return _.chain(results[1]) .map('author.user') .reject(_.isEmpty) .groupBy('login') .map(group => _.defaults({ commits: _.size(group) }, _.head(group))) .filter(user => _.isEmpty(collaborators[user.login])) .value() }) .then(res => formatOutput(res)) .catch(err => console.log(err))