Tabnine Logo For Javascript
_
Code IndexAdd Tabnine to your IDE (free)

How to use
_
function
in
lodash

Best JavaScript code snippets using lodash._(Showing top 15 results out of 378)

origin: lando/lando

// Contributors by alliance role
 api.get('/v1/alliance/:role', handler((req, res) => {
  const roles = getRoles(req.params.role);
  roles.push('everything');
  return _(utils.loadFile(contributorsFile))
   .filter(person => !_.isEmpty(_.intersection(roles, lca(person.role))))
   .values();
 }));
origin: lando/lando

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

_(services)
 // Break apart platform type into typ and version
 .map(service => _.merge({}, service, getPlatformServiceType(service)))
 // Filter out services that are not supported yet
 .filter(service => getLandoServiceType(service.type) !== false)
 // Merge in other needed lando things
 .map(service => _.merge({}, getLandoService(service), {runConfig: _.find(runConfig, {service: service.name})}))
 // Finally map to an object
 .map(service => ([service.name, service]))
 .fromPairs()
 .value()
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

_(process.env)
 // Only muck with prefix_ variables
 .pickBy((value, key) => _.includes(key, prefix))
 // Prep the keys for consumption
 .mapKeys((value, key) => _.camelCase(_.trimStart(key, prefix)))
 // If we have a JSON string as a value, parse that and assign its sub-keys
 .mapValues(exports.tryConvertJson)
 // Resolve the lodash wrapper
 .value()
origin: lando/lando

_(fs.readdirSync(baseDir, {withFileTypes: true}))
  .filter(dirent => dirent.isDirectory())
  .map(dirent => dirent.name)
  .concat('.')
  .map(directory => path.resolve(baseDir, directory, '.platform.app.yaml'))
  .filter(file => fs.existsSync(file))
  .map(file => ({data: yamlPlatform.load(fs.readFileSync(file)), file}))
  .map(data => ({name: data.data.name, file: data.file, dir: path.dirname(data.file)}))
  .value()
origin: lando/lando

_(composeData)
 .flatMap(data => data.data)
 .flatMap(data => _.keys(data.services))
 .uniq()
 .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

_(config.LANDO_METRICS_PLUGINS)
 .map(plugin => _.merge({}, plugin, {path: path.resolve(__dirname, 'plugins', `${plugin.name}.js`)}))
 .filter(plugin => fs.existsSync(plugin.path))
 .map(plugin => _.merge({}, plugin, {Reporter: require(plugin.path)}))
 .value()
origin: lando/lando

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

/*
 * Helper to find containers that serve
 */
const getOtherServingContainers = services => _(services)
 .filter(service => service.type === 'lagoon-varnish')
 .map('name')
 .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

/*
 * Helper to get the applications environment variables
 */
const getEnvironmentVariables = appConfig => _(_.get(appConfig, 'variables.env', {}))
 .map((value, key) => ([key, (_.isObject(value)) ? JSON.stringify(value) : value]))
 .fromPairs()
 .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()
origin: lando/lando

_(_.flatten([...sources]))
 .sortBy('date')
 .groupBy('email')
 .map(tokens => _.last(tokens))
 .value()
lodash(npm)_

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

  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • winston
    A logger for just about everything.
  • debug
    small debugging utility
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • aws-sdk
    AWS SDK for 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.
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • Best IntelliJ 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