Codota Logo For Javascript
Collection.flatMap
Code IndexAdd Codota to your IDE (free)

How to use
flatMap
function
in
Collection

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

origin: lando/lando

// Helper to get init source config
const getInitSourceConfig = dirs => _(dirs)
 .filter(dir => fs.existsSync(dir))
 .flatMap(dir => glob.sync(path.join(dir, '*.js')))
 .map(file => require(file))
 .flatMap(source => source.sources)
 .value()
origin: lando/lando

// Helper to get init config
const getInitConfig = dirs => _(dirs)
 .filter(dir => fs.existsSync(dir))
 .flatMap(dir => glob.sync(path.join(dir, '*', 'init.js')))
 .map(file => require(file))
 .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

// Add proxy URLS to our app info
  _.forEach(['post-start', 'post-init'], event => {
   app.events.on(event, () => {
    // Get last known ports
    const ports = lando.cache.get(lando.config.proxyCache);
    // Map to protocol and add portz
    // @TODO: do something more meaningful below like logging?, obviously starting to not GAS
    if (ports) {
     _(app.info)
      .filter(service => _.has(app, `config.proxy.${service.service}`))
      .flatMap(s => s.urls = _.uniq(s.urls.concat(utils.parse2Info(
       app.config.proxy[s.service],
       ports,
       _.get(s, 'hasCerts', false)
      ))))
      .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

/*
 * Helper to bootstrap app stuffs
 */
const bootstrapApp = lando => {
 const Factory = require('./factory');
 const Yaml = require('./yaml');
 lando.factory = new Factory();
 lando.yaml = new Yaml(lando.log);
 // Load in all our builders in the correct order
 const builders = _(['compose', 'types', 'services', 'recipes'])
  .flatMap(type => _.map(lando.config.plugins, plugin => plugin[type]))
  .filter(dir => fs.existsSync(dir))
  .flatMap(dir => glob.sync(path.join(dir, '*', 'builder.js')))
  .map(file => lando.factory.add(require(file)).name)
  .value();
 // Log
 _.forEach(builders, builder => lando.log.debug('autoloaded builder %s', builder));
}
origin: lando/lando

_(_.flatten([data]))
 .flatMap(group => _.map(group.data, (compose, index) => ({data: compose, file: `${group.id}-${index}.yml`})))
 .map(compose => yaml.dump(path.join(dir, compose.file), compose.data))
 .value()
origin: lando/lando

const initSources = _(inits).filter(init => _.has(init, 'sources')).flatMap(init => init.sources).value();
origin: lando/lando

_(composeData)
 .flatMap(data => data.data)
 .flatMap(data => _.keys(data.services))
 .uniq()
 .value()
origin: lando/lando

_(urls)
 .map(url => exports.parseUrl(url))
 .flatMap(url => getInfoUrls(url, ports, hasCerts))
 .value()
origin: magda-io/magda

_(lernaJson.packages)
  .map((package) => package + "/package.json")
  .flatMap((package) => glob.sync(package))
  .map((packagePath) => {
    const packageJson = require(path.resolve(packagePath));
    return packageJson;
  })
  .filter(function (packageJson) {
    return filters.every(({ key, value }) => {
      return (
        _.get(packageJson.magda, key, "").toString() === value &&
        value.toString()
      );
    });
  })
  .map((packageJson) => packageJson.name)
  .value()
origin: magda-io/magda

} else {
  const regionNames: string[] = _(boostRegions)
    .flatMap((region) => [
      region.regionName,
      region.regionShortName
lodash(npm)CollectionflatMap

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

  • aws-sdk
    AWS SDK for JavaScript
  • ms
    Tiny millisecond conversion utility
  • lodash
    Lodash modular utilities.
  • commander
    the complete solution for node.js command-line programs
  • js-yaml
    YAML 1.2 parser and serializer
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • http
  • postcss
  • colors
    get colors in your node.js console
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now