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

How to use
compact
function
in
Collection

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

origin: lando/lando

// Helper to get excludes
const getExcludes = (data = [], inverse = false) => _(data)
 .filter(exclude => _.startsWith(exclude, '!') === inverse)
 .map(exclude => _.trimStart(exclude, '!'))
 .uniq()
 .compact()
 .value()
origin: lando/lando

_(normalizeRoutes(routes))
 // Map redirects to upstreams
 .map(route => getUpstream(route, normalizeRoutes(routes)))
 // Remove blank entries
 .compact()
 // Parse to lando things
 .map(route => _.merge({}, url.parse(route.key), {service: route.upstream.split(':')[0]}))
 // Filter unsupported upstreams
 .filter(route => _.includes(_.map(supported, 'name'), route.service))
 // Merge in port data
 .map(route => _.merge({}, route, _.find(supported, {name: route.service})))
 // Add port to data
 .map(route => ({service: route.service, config: getProxyMiddlewares(route)}))
 // Group by service
 .groupBy('service')
 // Map to lando proxy config
 .map((entries, service) => ([service, _.map(entries, 'config')]))
 // objectify
 .fromPairs()
 // Return
 .value()
origin: lando/lando

// Add all the apps containers to the lando bridge network after the app starts
 // @NOTE: containers are automatically removed when the app stops
 app.events.on('post-start', 1, () => {
  // We assume the lando net exists at this point
  const landonet = lando.engine.getNetwork(lando.config.networkBridge);
  // List all our app containers
  return lando.engine.list({project: app.project})
  // Go through each container
  .map(container => {
   // Grab from the proxy if we have them
   const aliases = _(_.get(app, `config.proxy.${container.service}`, []))
    .map(entry => _.isString(entry) ? entry : entry.host)
    .compact()
    .value();
   aliases.push(`${container.service}.${container.app}.internal`);
   // Sometimes you need to disconnect before you reconnect
   return landonet.disconnect({Container: container.id, Force: true})
   // Only throw non not connected errors
   .catch(error => {
    if (!_.includes(error.message, 'is not connected to network lando')) throw error;
   })
   // Connect
   .then(() => {
    landonet.connect({Container: container.id, EndpointConfig: {Aliases: aliases}});
    app.log.debug('connected %s to the landonet', container.name);
   });
  });
 });
origin: welkinwong/nodercms

.compact();
origin: fabienvauchelles/scrapoxy

return _(cfg.providers)
  .map(getProvider)
  .compact()
  .value();
origin: showroom101/Example-ImageLibary

function getLatestVersion() {
  var tags = execSync("git tag");
  var latest = _(tags).split("\n")
    .compact()
    .sort(semver.gt)
    .last();
  console.log("Latest tag is ", latest);
  return latest;
}
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: geekuillaume/ChatUp

function registerInRedis(worker: ChatWorker, redisConnection: redis.RedisClient, stats:any):Promise<void> {
 return new Promise<void>(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((stats, channel:any) => {
     stats[channel.name] = _.union(stats[channel.name] || [], channel.publishers);
     return stats;
    }, {})),
    subStats: JSON.stringify(stats)
   })
   .pexpire(keyName, worker._conf.expireDelay)
   .exec((err, results) => {
    if (err) {
     logger.captureError(logger.error('Redis register', {err}));
     return reject(err);
    }
    return resolve();
   });
 });
}
lodash(npm)Collectioncompact

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

  • minimist
    parse argument options
  • js-yaml
    YAML 1.2 parser and serializer
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • 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
  • crypto
  • glob
    a little globber
  • debug
    small debugging utility
  • 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