_(_.flatten([...sources])) .sortBy('date') .groupBy('email') .map(tokens => _.last(tokens)) .value()
_(files) .flatMap(file => traverseUp(path.resolve(startFrom, file))) .sortBy().reverse() .filter(file => fs.existsSync(file) && path.isAbsolute(file)) .thru(files => _.isEmpty(files) ? [] : [_.first(files)]) .flatMap(dirFile => _.map(files, file => path.join(path.dirname(dirFile), file))) .filter(file => fs.existsSync(file)) .value()
_(options) .keys() .sortBy() .map(key => [key, options[key]]) .fromPairs() .value()
.sortBy('priority')
async function getHotsData () { const API_ORIGIN = 'https://www.hotslogs.com' const HEROES__URL = `${API_ORIGIN}/api/Data/Heroes` const IMG_BASE_URL = `${API_ORIGIN}/Images/Heroes/Portraits/` const res = await axios.get(HEROES__URL) const candidates = _(res.data).map((val) => { val.id = val.PrimaryName val.name = val.PrimaryName val.img = IMG_BASE_URL + val.ImageURL + '.png' return val }).sortBy('name').value() return candidates }
async function fetchLolData () { const API_BASE_URL = 'https://ddragon.leagueoflegends.com/' const VERSION_URL = API_BASE_URL + 'realms/na.json' const CDN_BASE_URL = API_BASE_URL + 'cdn/' const championDataUrl = (apiVersion) => { return `${CDN_BASE_URL}${apiVersion}/data/en_US/champion.json` } const imgUrl = (apiVersion, name) => { return `${CDN_BASE_URL}${apiVersion}/img/champion/${name}` } let resp = await axios.get(VERSION_URL) const { champion: championVersion, profileicon: iconVersion } = resp.data.n resp = await axios.get(championDataUrl(championVersion)) const candidates = _(resp.data.data).map((val) => { val.name = val.id val.img = imgUrl(iconVersion, val.image.full) return val }).sortBy('name').value() return candidates }
identifier: hit.identifier })) .sortBy((hit) => -hit.hitCount) .drop(start) .take(limit)
.filter((x) => !!x && x !== "") .map((x) => x as string) .sortBy((x: string) => x.length) .value();
_(_.flatten([...sources])) .sortBy('date') .groupBy('email') .map(tokens => _.last(tokens)) .value()
// Helper to sort tokens const sortTokens = (...sources) => _(_.flatten([...sources])) .sortBy('date') .groupBy('user') .map(tokens => _.last(tokens)) .value()