Tabnine Logo For Javascript
Collection.thru
Code IndexAdd Tabnine to your IDE (free)

How to use
thru
function
in
Collection

Best JavaScript code snippets using lodash.Collection.thru(Showing top 13 results out of 315)

origin: lando/lando

// Helper to get tokens
const getTokens = (home, tokens = []) => _(utils.sortTokens(utils.getTerminusTokens(home), tokens))
 .map(token => ({name: token.email, value: token.token}))
 .thru(tokens => tokens.concat([{name: 'add or refresh a token', value: 'more'}]))
 .value()
origin: lando/lando

/*
 * Helper to get appMount
 */
const getAppMount = (app, base, files) => {
 if (_.has(app, 'source.root')) return path.join(base, app.source.root);
 return _(files)
  .filter(file => file.name === app.name)
  .thru(file => file[0].dir)
  .value();
}
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

_(loadCacheFile(config.toolingRouter))
   .map(route => _.merge({}, route, {
    closeness: _.indexOf(pathsToRoot(), route.route),
   }))
   .filter(route => route.closeness !== -1)
   .orderBy('closeness')
   .thru(routes => routes[0])
   .value()
origin: lando/lando

_(apps)
 .map(app => app.relationships || [])
 .flatten()
 .thru(relationships => relationships[0])
 .map((relationship, alias) => ({
  alias,
  service: relationship.split(':')[0],
  endpoint: relationship.split(':')[1],
  creds: _.get(open, alias, {}),
 }))
 .groupBy('service')
 .value()
origin: lando/lando

constructor(id, options = {}, factory) {
   options = _.merge({}, config, options);
   // Get route for this service
   const primaryRoute = _(_.get(options, '_app.platformsh.routes', []))
    .map((config, url) => _.merge({}, config, {url}))
    .filter(route => route.type === 'upstream')
    .filter(route => route.upstream.split(':')[0] === options.name)
    .orderBy('primary', ['desc'])
    .thru(routes => routes[0].url)
    .value();
   // Build the php
   const php = {
    image: `docker.registry.platform.sh/php-${options.version}`,
    volumes: options.volumes,
    ports: ['80'],
    environment: {
     DRUSH_OPTIONS_URI: primaryRoute,
    },
   };

   // Add in the php service and push downstream
   super(id, options, {services: _.set({}, options.name, php)});
  }
origin: lando/lando

_(data)
    .map((value, index) => new Table(value, opts))
    .map(table => table.toString())
    .thru(data => data.join(os.EOL))
    .value()
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: lando/lando

_(excludes)
 .thru(excludes => toObject(getNamedVolumeNames(excludes)))
 .value()
origin: lando/lando

_(files)
 .filter(file => fs.existsSync(file))
 .map(file => yaml.safeLoad(fs.readFileSync(file)))
 .thru(data => _.merge({}, ...data))
 .thru(data => {
  // Set the php version
  // @TODO: what is the best version here?
  data.php = _.toString(_.get(data, 'php_version', '5.6'));
  // Set the webroot
  data.webroot = (_.get(data, 'web_docroot', false)) ? 'web' : '.';
  // Set the drush version
  data.drush = _.toString(_.get(data, 'drush_version', '8'));
  // if drush version is less than 8, use 8 anyway
  if (data.drush < 8) data.drush = 8;
  // return
  return data;
 })
 .value()
origin: lando/lando

_(apps)
 .filter(app => app.closeness !== -1)
 .orderBy('closeness')
 .thru(apps => apps[0])
 .value()
origin: lando/lando

_(keys)
 .map(service => data)
 .map((service, index) => _.set({}, keys[index], service))
 .thru(services => _.reduce(services, (sum, service) => _.merge(sum, service), {}))
 .value()
origin: lando/lando

// Helper to get tokens
const getTokens = (home, tokens = []) => _(utils.sortTokens(utils.getPlatformshTokens(home), tokens))
 .map(token => ({name: token.email, value: token.token}))
 .thru(tokens => tokens.concat([{name: 'add or refresh a token', value: 'more'}]))
 .value()
lodash(npm)Collectionthru

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

  • glob
    a little globber
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • moment
    Parse, validate, manipulate, and display dates
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • async
    Higher-order functions and common patterns for asynchronous code
  • mime-types
    The ultimate javascript content-type utility.
  • Top PhpStorm plugins
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