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

How to use
first
function
in
LoDashStatic

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

origin: lando/lando

/*
 * Helper to convert a command into config object
 */
const parseCommand = (cmd, service) => ({
 command: (_.isObject(cmd)) ? cmd[_.first(_.keys(cmd))] : cmd,
 service: (_.isObject(cmd)) ? _.first(_.keys(cmd)) : service,
})
origin: lando/lando

/*
 * Helper to parse a command into useful metadataz
 */
const parseCmd = meta => _.merge({}, meta, {
 bin: _.trimEnd(path.basename(_.first(meta._), '"')),
 cmd: meta._[1],
 args: _.drop(meta._, 2),
})
origin: lando/lando

/*
 * Helper to return a type and version from platform data
 */
const getPlatformServiceType = ({name = 'app', type} = {}) => ({
 name,
 type: _.first(type.split(':')),
 version: _.last(type.split(':')),
})
origin: lando/lando

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

// Set a different default if needed
 lando.events.on('cli-ssh-run', 2, data => {
  if (data.options.service === 'appserver') {
   // Discovery
   const services = _.keys(data.options._app.services);
   const hasRecipe = _.has(data, 'options._app.recipe');

   // If this is not a recipe and we have no appserver container then set a new default
   if (!hasRecipe && !_.includes(services, 'appserver')) {
    data.options.service = _.first(services);
    data.options.s = data.options.service;
   }
  }
 });
origin: lando/lando

// Switch the default service for the ssh command if its used
 lando.events.on('cli-ssh-run', data => {
  if (_.get(data, 'options._app.recipe') === 'lagoon' && data.options.service === 'appserver') {
   // Get lagoon config
   const appRoot = _.get(data, 'options._app.root', process.cwd());
   const config = lagoonConf.loadConfigFiles(appRoot);
   // Find CLI containers
   const cliServices = _(_.get(config, 'compose.services', {}))
    .map((service, name) => _.merge({}, service, {name}))
    .filter(service => _.includes(cliServiceTypes, service.labels['lando.type']))
    .map('name')
    .value();
   // Use the first CLI container we find
   data.options.service = _.first(cliServices);
   data.options.s = _.first(cliServices);
  }
 });
origin: lando/lando

_(routes)
 // Add implicit data and defaults
 .map((config, url) => ([url, _.merge({primary: false, attributes: {}, id: null, original_url: url}, config)]))
 // Replace URL defaults
 .map(route => ([replaceDefault(route[0], domain), route[1]]))
 // Replace config defaults
 .map(route => ([route[0], _.merge(route[1], replaceDefault(_.omit(route[1], ['original_url']), domain))]))
 // Strip upstream if needed
 .map(route => {
  if (route[1].upstream) route[1].upstream = _.first(route[1].upstream.split(':'));
  return [route[0], route[1]];
 })
 // Back to object
 .fromPairs()
 // Set the primary route
 .thru(routes => setPrimaryRoute(routes))
 // Return
 .value()
origin: lando/lando

// Key find helper
const getFirstKey = obj => _.first(_.keys(obj))
origin: lando/lando

 const key = _.first(option.split('='));
 _.set(landoFile, `config.${key}`, _.last(option.split('=')));
});
origin: lando/lando

/*
 * Helper to get config defaults
 */
const getConfigDefaults = options => {
 // Get the viaconf
 if (_.startsWith(options.via, 'nginx')) options.defaultFiles.vhosts = 'default.conf.tpl';

 // Get the default db conf
 const dbConfig = _.get(options, 'database', 'mysql');
 const database = _.first(dbConfig.split(':'));
 const version = _.last(dbConfig.split(':'));
 if (database === 'mysql' || database === 'mariadb') {
  if (version === '8.0') {
   options.defaultFiles.database = 'mysql8.cnf';
  } else {
   options.defaultFiles.database = 'mysql.cnf';
  }
 }

 // Verify files exist and remove if it doesn't
 _.forEach(options.defaultFiles, (file, type) => {
  if (!fs.existsSync(`${options.confDest}/${file}`)) {
   delete options.defaultFiles[type];
  }
 });

 // Return
 return options.defaultFiles;
}
origin: lando/lando

constructor(id, options = {}) {
   // Get our options
   options = _.merge({}, config, options);
   // Get the lagoon config weve loaded and parsed
   const lagoonConfig = _.get(options, '_app.lagoon', {});

   // Map into lando services
   options.services = getLandoServices(lagoonConfig.services);
   // Add in any additional dev services eg mailhog we need
   options.services = getLandoAuxServices(options.services, options._app._config);

   // Map into lando tooling commands
   options.tooling = getLandoTooling(options.services);
   // If we have a SQL service then add in the db import/export commands
   const sqlServices = getSQLServices(options.services);
   if (!_.isEmpty(sqlServices)) {
    const firstDbService = _.first(sqlServices);
    options.tooling = _.merge({}, options.tooling, getDBUtils(firstDbService.name));
   }
   // If we have the lagoong cli then add that in as well
   if (_.has(options, 'services.lagooncli')) {
    options.tooling.lagoon = {service: 'lagooncli', cmd: '/lagoon', user: 'root'};
   }

   // Map into lando proxy routes
   options.proxy = getLandoProxyRoutes(options.services, _.get(options, '_app.lagoon.domain'));

   // Send downstream
   super(id, options);
  }
origin: lando/lando

const run = child.spawn(_.first(cmd), _.tail(cmd), _.merge({}, {detached, cwd}, stdio));
origin: leossnet/jetcalc

self.rGet("rows", Context, function(data) {
      data.forEach(function(d) {
        d.DoRemove = false;
        d.IsNew = false;
      })
      self.Rows = data;
      self.GetClassInfo();
      var Doc = MFolders.FindDocument(CxCtrl.CodeDoc());
      var Root = _.first(Doc.Link_docrow);
      if (Root && Root.CodeRow) self.RootBase = Root.CodeRow;
      return done && done()
    })
origin: leossnet/jetcalc

getRawCoreInfo(i, function (rawCoreInfo) {
        rawCoreInfo.forEach(function (rawInfo) {
          var info = rawInfo.split(':');
          
          var key   = _.camelCase(_.trim(_.first(info)));
          var value = _.trim(_.last(info));

          coreInfo[key] = value;
        });
      });
origin: cmake-js/cmake-js

function testSum(sums, sum, fPath) {
  let serverSum = _.first(sums.filter(function (s) {
    return s.getPath === fPath;
  }));
  if (serverSum && serverSum.sum === sum) {
    return;
  }
  throw new Error("SHA sum of file '" + fPath + "' mismatch!");
}
lodash(npm)LoDashStaticfirst

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

  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • js-yaml
    YAML 1.2 parser and serializer
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • redis
    Redis client library
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • debug
    small debugging utility
  • chalk
    Terminal string styling done right
  • glob
    a little globber
  • 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