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

How to use
flatten
function
in
Collection

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

origin: lando/lando

_(parsedServices)
  .map(service => getServiceToolingByType(service, app))
  .flatten()
  .filter(service => service.name)
  .map(service => ([service.name, _.omit(service, 'name')]))
  .fromPairs()
  .value()
origin: lando/lando

_(cmds)
 // Set service if needed
 .map(cmd => _.isString(cmd) ? _.set({}, fallback, cmd) : cmd)
 // Extract the service data
 .map(cmd => _.map(cmd, (cmd, service) => ([service, cmd])))
 // Flatten the thing
 .flatten()
 // Prefix if needed
 .map(data => {
  if (_.includes(needsPrefix, data[0])) data[1] = `/helpers/psh-exec.sh ${data[1]}`;
  return _.set({}, data[0], data[1]);
 })
 // Return
 .value()
origin: lando/lando

mailchimp.get('lists/613837077f/interest-categories').then(results => {
  return Promise.all(_(_.get(results, 'categories', []))
   .map(category => category.id)
   .map(id => mailchimp.get(`lists/613837077f/interest-categories/${id}/interests`))
   .value())
   .then(categories => _(categories)
    .map(category => category.interests)
    .flatten()
    .map(interest => ({name: interest.name, id: interest.id}))
   )
   .then(interests => _(interests)
    .filter(interest => _.includes(groups, interest.name))
    .map(interest => ([interest.id, true]))
    .fromPairs()
    .value()
   );
 })
 // Update the contact
 .then(interests => {
  const lowerEmail = _.toLower(email);
  return mailchimp.put(`/lists/613837077f/members/${utils.md5(lowerEmail)}`, {
   email_address: lowerEmail,
   interests: _.merge({}, defaults, interests),
   status: 'subscribed',
  });
 })
origin: lando/lando

_(relationships)
 .map(relationship => relationship)
 .flatten()
 .map('service')
 .uniqBy()
 .value()
origin: lando/lando

_(services)
 .map((config, name) => _.merge({}, config, {
  aliases: _.has(relationships, name) ? _.map(relationships[name], 'alias') : [],
  application: false,
  creds: _(_.get(relationships, name, {}))
   .map('creds')
   .flatten()
   .value(),
  hostname: name,
  name,
  opener: JSON.stringify({relationships: parseServiceRelationships(config)}),
 }))
 .value()
origin: lando/lando

const services = _.flatten([platformConfig.applications, platformConfig.services]);
 ]))
 .flatten()
 .flatten()
 .fromPairs()
 .value();
 ]))
 .flatten()
 .flatten()
 .fromPairs()
 .value();
origin: lando/lando

.filter(event => _.has(event, 'payload.commits'))
.map(event => event.payload.commits)
.flatten()
.filter(commit => _.has(commit, 'author.name'))
.filter(commit => commit.author.name === response.name)
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

_(services)
 .map(service => getServiceToolingByType(service))
 .filter(tools => !_.isEmpty(tools))
 .map(tools => _.map(tools, (config, name) => ([name, config])))
 .flatten()
 .fromPairs()
 .value()
origin: fabienvauchelles/scrapoxy

.then(() => {
  const count = _(result)
    .flatten()
    .countBy()
    .value();
origin: fabienvauchelles/scrapoxy

.flatten()
.value();
origin: geekuillaume/ChatUp

function registerInRedis(worker, redisConnection, stats) {
  return new Promise(function (resolve, reject) {
    var keyName = "chatUp:chatServer:" + worker._conf.uuid;
    redisConnection.multi()
      .hmset(keyName, {
      host: worker._conf.host,
      connections: _(worker._workers).map('stats').map('connections').sum(),
      pubStats: JSON.stringify(_(worker._workers).map('stats').map('channels').flatten().compact().reduce(function (stats, channel) {
        stats[channel.name] = _.union(stats[channel.name] || [], channel.publishers);
        return stats;
      }, {})),
      subStats: JSON.stringify(stats)
    })
      .pexpire(keyName, worker._conf.expireDelay)
      .exec(function (err, results) {
      if (err) {
        logger.captureError(logger.error('Redis register', { err: err }));
        return reject(err);
      }
      return resolve();
    });
  });
}
origin: ohbarye/review-waiting-list-bot

async getAllPullRequests({author, repo, user, assignee}) {
  author.values = _(await Promise.all(
   author.values.map((author) => {
    return this.isTeam(author) ? this.getTeamMembers(author) : author
   })
  )).flatten()
   .uniq()
   .value()
  const prs = await this.getPullRequestsForAuthors(author, repo, user, assignee)
  return _.flattenDeep(prs)
 }
origin: lando/lando

mailchimp.get('lists/613837077f/interest-categories').then(results => {
  return Promise.all(_(_.get(results, 'categories', []))
   .map(category => category.id)
   .map(id => mailchimp.get(`lists/613837077f/interest-categories/${id}/interests`))
   .value())
   .then(categories => _(categories)
    .map(category => category.interests)
    .flatten()
    .map(interest => ({name: interest.name, id: interest.id}))
   )
   .then(interests => _(interests)
    .filter(interest => _.includes(groups, interest.name))
    .map(interest => ([interest.id, true]))
    .fromPairs()
    .value()
   );
 })
 // Update the contact
 .then(interests => {
  const lowerEmail = _.toLower(email);
  return mailchimp.put(`/lists/613837077f/members/${utils.md5(lowerEmail)}`, {
   email_address: lowerEmail,
   interests: _.merge({}, defaults, interests),
   status: 'subscribed',
  });
 })
origin: lando/lando

.filter(event => _.has(event, 'payload.commits'))
.map(event => event.payload.commits)
.flatten()
.filter(commit => _.has(commit, 'author.name'))
.filter(commit => commit.author.name === response.name)
lodash(npm)Collectionflatten

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

  • 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.
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • commander
    the complete solution for node.js command-line programs
  • crypto
  • webpack
    Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • mongodb
    The official MongoDB driver for Node.js
  • Top Sublime Text 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