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

How to use
flatten
function
in
LoDashStatic

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

origin: lando/lando

/*
 * Parse docker-compose options
 */
const parseOptions = (opts = {}) => {
 const flags = _.map(composeFlags, (value, key) => _.get(opts, key, false) ? value : '');
 const environment = _.flatMap(opts.environment, (value, key) => ['--env', `${key}=${value}`]);
 const user = (_.has(opts, 'user')) ? ['--user', opts.user] : [];
 const workdir = (_.has(opts, 'workdir')) ? ['--workdir', opts.workdir] : [];
 const entrypoint = _.map(opts.entrypoint, entrypoint => ['--entrypoint', entrypoint]);
 return _.compact(_.flatten([flags, environment, user, workdir, entrypoint]));
}
origin: lando/lando

_(_.flatten([...sources]))
 .sortBy('date')
 .groupBy('email')
 .map(tokens => _.last(tokens))
 .value()
origin: lando/lando

/*
 * Helper to standardize construction of docker commands
 */
const buildCmd = (run, name, compose, {services, cmd}, opts = {}) => {
 if (!name) throw new Error('Need to give this composition a project name!');
 // @TODO: we need to strip out opts.user on start/stop because we often get it as part of run
 const project = ['--project-name', name];
 const files = _.flatten(_.map(compose, unit => ['--file', unit]));
 const options = parseOptions(opts);
 const argz = _.flatten(_.compact([services, cmd]));
 return _.flatten([project, files, run, options, argz]);
}
origin: lando/lando

api.auth().then(() => api.getSiteEnvs(site)
 .map(env => ({name: env.id, value: env.id}))
 .filter(env => !_.includes(nopes, env.value))
 .then(envs => _.flatten([envs, [{name: 'none', value: 'none'}]])))
 .catch(err => {
  throw (_.has(err, 'response.data')) ? new Error(err.response.data) : err;
 })
origin: lando/lando

// Helper to parse tokens into choices
const parseTokens = tokens => _.flatten([getTokens(tokens), [{name: 'add or refresh a token', value: 'more'}]])
origin: lando/lando

// Add in some computed config eg things after our config has been settled
 lando.events.on('post-bootstrap-config', ({config}) => {
  lando.log.verbose('building proxy config...');
  // Set some non dependent things
  config.proxyContainer = `${lando.config.proxyName}_proxy_1`;
  config.proxyCurrentPorts = {http: config.proxyHttpPort, https: config.proxyHttpsPort};
  config.proxyDir = path.join(lando.config.userConfRoot, 'proxy');
  config.proxyHttpPorts = _.flatten([config.proxyHttpPort, config.proxyHttpFallbacks]);
  config.proxyHttpsPorts = _.flatten([config.proxyHttpsPort, config.proxyHttpsFallbacks]);
  config.proxyLastPorts = lando.cache.get(lando.config.proxyCache);
  config.proxyNet = `${config.proxyName}_edge`;
  config.proxyScanHttp = utils.ports2Urls(config.proxyHttpPorts, false, config.proxyBindAddress);
  config.proxyScanHttps = utils.ports2Urls(config.proxyHttpsPorts, true, config.proxyBindAddress);
  // And dependent things
  config.proxyConfigDir = path.join(config.proxyDir, 'config');
 });
origin: lando/lando

/*
 * Helper to get all ports
 */
const getAllPorts = (noHttp = false, noHttps = false, config) => {
 const {proxyHttpPort, proxyHttpsPort, proxyHttpFallbacks, proxyHttpsFallbacks} = config;
 const ports = [];
 if (noHttp) {
  ports.push(proxyHttpPort);
  ports.push(proxyHttpFallbacks);
 }
 if (noHttps) {
  ports.push(proxyHttpsPort);
  ports.push(proxyHttpsFallbacks);
 }
 return _.flatten(ports).join(', ');
}
origin: lando/lando

// Helper to get popuylation command
const getPopCommand = (excludes = []) => _.compact(_.flatten([['/helpers/mounter.sh'], excludes]))
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

_(deps)
 .map((version, pkg) => _.flatten([prefix, pkger(pkg, version)]))
 .map(command => command.join(' '))
 .value()
origin: lando/lando

// Helper to get pantheon auth non-interactive options
const getInteractiveOptions = (tokens = []) => ({
 'auth': {
  interactive: {
   choices: _.flatten([getTokens(tokens), [{name: 'add or refresh a token', value: 'more'}]]),
   when: answers => !_.isEmpty(tokens),
   weight: 100,
  },
 },
 'machine-token': {
  hidden: true,
  interactive: {
   name: 'auth',
   type: 'password',
   message: 'Enter a Pantheon machine token',
   when: answers => _.isEmpty(tokens) || (_.get(answers, 'auth', '') === 'more'),
   weight: 101,
  },
 },
})
origin: lando/lando

_(services)
  .groupBy('platformsh.type')
  .map((service, type) => _.merge({}, {type}, {
   services: _.flatten(_.map(service, s => parsedRelationships[s.name])),
  }))
  .value()
origin: lando/lando

_(_.flatten([...sources]))
 .sortBy('date')
 .groupBy('email')
 .map(tokens => _.last(tokens))
 .value()
origin: lando/lando

// Helper to sort tokens
const sortTokens = (...sources) => _(_.flatten([...sources]))
 .sortBy('date')
 .groupBy('user')
 .map(tokens => _.last(tokens))
 .value()
origin: lando/lando

// Helper to get pantheon auth non-interactive options
const getInteractiveOptions = (tokens = []) => ({
 'auth': {
  interactive: {
   choices: _.flatten([getTokens(tokens), [{name: 'add or refresh a token', value: 'more'}]]),
   when: answers => !_.isEmpty(tokens),
   weight: 100,
  },
 },
 'api-token': {
  hidden: true,
  interactive: {
   name: 'auth',
   type: 'password',
   message: 'Enter a Platform.sh API token',
   when: answers => _.isEmpty(tokens) || (_.get(answers, 'auth', '') === 'more'),
   weight: 101,
  },
 },
})
lodash(npm)LoDashStaticflatten

JSDoc

Flattens `array` a single level deep.

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

  • mocha
    simple, flexible, fun test framework
  • request
    Simplified HTTP request client.
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • debug
    small debugging utility
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • js-yaml
    YAML 1.2 parser and serializer
  • minimist
    parse argument options
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • minimatch
    a glob matcher in javascript
  • Best plugins for Eclipse
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