_.maxBy(db, a => a.age)
parse(torrent) { let newTorrent = { ...torrent, categories: [], type: '' }; // Categorise by torrent Name this.getVideoCategories(newTorrent, newTorrent); this.getMediaCategories(newTorrent, newTorrent); // Categorise by file with maximum size const file = _.maxBy(torrent.files, 'size') this.getCategories(file, newTorrent); newTorrent.categories = _.uniq(newTorrent.categories); delete newTorrent.count; return newTorrent; }
const getFileType = function(list) { let subList = _.filter(list, function(o) { return o.name.indexOf('请升级到BitComet') === -1 }) let maxobj = _.maxBy(subList, 'length') let type = '' if(maxobj.name){ type = maxobj.name.substring(maxobj.name.lastIndexOf('.') + 1) } list = subList.map((item, index) => { return { name: item.name, size: item.length } }) return { type, list } }
_.unzip(i.map(_.values)).map(v => _.maxBy(v, c => v.join``.split(c).length))
function isThisUserTheWinnerOfThisAuction(userId, auctionId) { console.log('ja'); models.Bid.findAll({ where: { auctionId: auctionId } }).then(bids => { if (bids.length > 0) { let winner = _.maxBy(bids, 'current_bid') if (winner.userId == userId) { console.log('lan'); return 1 } else { return 0 } } else { return 0 } }) }
models.Bid.findAll({ where: { auctionId: auctionId } }).then(bids => { // console.log(' isi bids : ', bids); let bidsLength = bids.length if (bidsLength == 0) { models.Auction.findById(auctionId).then(auction => { if (auction) { resolve(auction.min_price) } else { reject('auction dengan id ' + auctionId + ' tidak ditemukan, posisi bidChacker.js') } }).catch(err => { reject('error ketika ambil data auction di highestBidOfTheAuction') }) } else { let highestBid = _.maxBy(bids, 'current_bid') resolve(highestBid.current_bid) } })
const latestUnhealthy = _.maxBy(anomaliesList, anomaly => anomaly.timestamp); const timestamp = latestUnhealthy && latestUnhealthy.timestamp * 1000; const isUnhealthy = (timestamp && timestamp >= (Date.now() - (alertFreqInSec * 1000)));
/** * Check post attachments * @inner * @param {Object} postData Post data * @param {Board} board Board document * @throws {PostingError} If post has more attachments than allowed by board * @throws {FileTooLargeError} If size of at least one of file exceeds maximum * size allowed by board */ const checkAttachments = (postData, board) => { const attachments = postData.attachments; if (attachments.length > board.maxFilesPerPost) { throw new PostingError('Too many files', 'attachments', attachments.length, 'body'); } if (attachments.length) { const biggestFile = _.maxBy(attachments, 'size'); if (biggestFile > board.maxFileSize) { throw new FileTooLargeError('attachments', biggestFile, 'body'); } } }
res.swagger.lastModified = _.maxBy(resources, "modifiedOn").modifiedOn;
if (o.length <= 1) return o[0]; else { return _.maxBy(o, g => _.indexOf(timeDims, g.timeDim));
finalResult.weight = auction.weight finalResult.description = auction.description finalResult.current_price = auction.Bids.length == 0 ? auction.min_price : _.maxBy(auction.Bids, 'current_bid').current_bid finalResult.bidderCount = auction.Bids.length == 0 ? 0 : auction.Bids.length finalResult.min_price = auction.min_price
_.maxBy(db, a => a.yearsActive)
AuctionsJoined.map(data => { let auctionWinner = _.maxBy(data.Auction.Bids, 'current_bid')
if (o.length <= 1) return o[0]; else { return _.maxBy(o, g => _.indexOf(timeDims, g.timeDim));