_(_.merge(_.get(data, 'Config.ExposedPorts', []), {'443/tcp': {}})) .map((value, port) => ({ port: _.head(port.split('/')), protocol: (_.includes(secured, port.split('/')[0])) ? 'https' : 'http'} )) .filter(exposed => _.includes(scan, exposed.port)) .flatMap(ports => _.map(_.get(data, `NetworkSettings.Ports.${ports.port}/tcp`, []), i => _.merge({}, ports, i))) .filter(ports => _.includes([bindAddress, '0.0.0.0'], ports.HostIp)) .map(ports => url.format({ protocol: ports.protocol, hostname: 'localhost', port: _.includes(scan, ports.port) ? ports.HostPort : '', })) .thru(urls => ({service: data.Config.Labels['com.docker.compose.service'], urls})) .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))
api.auth().then(() => Promise.all([api.getSites(), api.getUser()])) // Parse the dataz and set the things .then(results => { // Get our site and email const site = _.head(_.filter(results[0], site => site.name === options['pantheon-site'])); const user = results[1]; // Error if site doesn't exist if (_.isEmpty(site)) throw Error(`${site} does not appear to be a Pantheon site!`); // This is a good token, lets update our cache const cache = {token: options['pantheon-auth'], email: user.email, date: _.toInteger(_.now() / 1000)}; // Update lando's store of pantheon machine tokens const tokens = lando.cache.get(pantheonTokenCache) || []; lando.cache.set(pantheonTokenCache, utils.sortTokens(tokens, [cache]), {persist: true}); // Update app metdata const metaData = lando.cache.get(`${options.name}.meta.cache`); lando.cache.set(`${options.name}.meta.cache`, _.merge({}, metaData, cache), {persist: true}); // Add some stuff to our landofile return {config: { framework: _.get(site, 'framework', 'drupal'), site: _.get(site, 'name', options.name), id: _.get(site, 'id', 'lando'), }}; })
/** * @description Return Name file logger * @param {*} NameFile */ getNameFile (NameFile = '') { let _lastElement = NameFile.split('/').pop(); let _nameFile = _.head(_lastElement.split(':')); return _nameFile || 'none file'; }
router.get('/getTrendingTopics', function(req, res) { // returns trending topics. Twit.get('trends/place', _.assignIn({ id: 1940345, count: 25 }, req.query), function(err, data, response) { try { res.json({ RESULT_CODE: '1', DATA: data && _.head(data) ? _.head(data).trends.slice(0, 25) : [] }); } catch (e) { console.log(e) } }); });
function _conform(specs, values) { if (_.isEmpty(specs)) { return _.isEmpty(values) ? {} : invalidString; } for (let [head, rest] of generate(values)) { const [key, predicate] = _.head(specs); const conformHead = conform(predicate, head, true); if (conformHead !== invalidString) { const conformRest = _conform(_.tail(specs), rest); if (conformRest !== invalidString) { return _.merge({}, {[key]: conformHead}, conformRest); } } } return invalidString; }
getRouteFile (RouteFile = '') { console.log('getRouteFile', RouteFile); try { if (RouteFile !== '') { let _routeFile = _.head(RouteFile.split(':')); _routeFile = _routeFile.split('/'); _routeFile.pop(); _routeFile = _routeFile.join('/'); return _routeFile; } else { return '' } } catch (e) { return '' } }
const changedGrouped = _.mapValues( _.groupBy(req.body[arrayName], '_id'), _.head);
const documents = await model.find({ _id: { $in: ids } }); const groupedDocuments = _.mapValues(_.groupBy(documents, '_id'), _.head); const [foundItems, notFoundItems] = _.partition(items, item => _.has(groupedDocuments, _.get(item, pathToId)));
const items = _.mapValues( _.groupBy(req.body[arrayName], '_id'), _.head); const affectedDocuments = _.pickBy(res.locals.documents, (value, key) => _.has(items, key));
const boardsAvailable = _.map(_.filter(_.toPairs(userRoles), canViewReports), _.head); let availableBoardsQuery = {}; if (req.user.authority !== 'admin') {
.filter(hasValidFields) .map(fp.mapValues(_.head));
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))