Tabnine Logo For Javascript
LoDashStatic.head
Code IndexAdd Tabnine to your IDE (free)

How to use
head
function
in
LoDashStatic

Best JavaScript code snippets using lodash.LoDashStatic.head(Showing top 15 results out of 315)

origin: lando/lando

_(_.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()
origin: nodejs/nodejs.org

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))
origin: lando/lando

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'),
   }};
  })
origin: mycodebad/microservices-example

/**
   * @description Return Name file logger
   * @param {*} NameFile 
   */
  getNameFile (NameFile = '') {
   let _lastElement = NameFile.split('/').pop();    
   let _nameFile = _.head(_lastElement.split(':'));
   return _nameFile || 'none file';
  }
origin: kevalbhatt/node-angular-socket-twit

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)
      }

    });
  });
origin: mrijk/speculaas

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;
}
origin: mycodebad/microservices-example

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 ''
   }
   
  }
origin: compose-ex/smalldata

while(second >= _.head(list)[0]) {
 state = _.head(list)[1];
 list = _.tail(list);
origin: nukeop/pi-dashboard

let weatherData = _.head(data.list);
this.skyText.setContent(_.get(_.head(weatherData.weather), 'main'));
origin: WagonOfDoubt/kotoba.js

const changedGrouped = _.mapValues(
 _.groupBy(req.body[arrayName], '_id'),
 _.head);
origin: WagonOfDoubt/kotoba.js

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)));
origin: WagonOfDoubt/kotoba.js

const items = _.mapValues(
 _.groupBy(req.body[arrayName], '_id'),
 _.head);
const affectedDocuments = _.pickBy(res.locals.documents,
 (value, key) => _.has(items, key));
origin: WagonOfDoubt/kotoba.js

const boardsAvailable = _.map(_.filter(_.toPairs(userRoles), canViewReports), _.head);
let availableBoardsQuery = {};
if (req.user.authority !== 'admin') {
origin: WagonOfDoubt/kotoba.js

.filter(hasValidFields)
.map(fp.mapValues(_.head));
origin: nodejs/nodejs.org

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))
lodash(npm)LoDashStatichead

JSDoc

Gets the first element of array.

Most used lodash functions

  • LoDashStatic.map
    Creates an array of values by running each element in collection through iteratee. The iteratee is
  • LoDashStatic.isEmpty
    Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string
  • LoDashStatic.forEach
    Iterates over elements of collection invoking iteratee for each element. The iteratee is invoked wit
  • LoDashStatic.find
    Iterates over elements of collection, returning the first element predicate returns truthy for.
  • LoDashStatic.pick
    Creates an object composed of the picked `object` properties.
  • LoDashStatic.get,
  • LoDashStatic.isArray,
  • LoDashStatic.filter,
  • LoDashStatic.merge,
  • LoDashStatic.isString,
  • LoDashStatic.isFunction,
  • LoDashStatic.assign,
  • LoDashStatic.extend,
  • LoDashStatic.includes,
  • LoDashStatic.keys,
  • LoDashStatic.cloneDeep,
  • LoDashStatic.uniq,
  • LoDashStatic.isObject,
  • LoDashStatic.omit

Popular in JavaScript

  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • path
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • js-yaml
    YAML 1.2 parser and serializer
  • async
    Higher-order functions and common patterns for asynchronous code
  • chalk
    Terminal string styling done right
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • mime-types
    The ultimate javascript content-type utility.
  • request
    Simplified HTTP request client.
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now