Tabnine Logo For Javascript
Collection.compact
Code IndexAdd Tabnine 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

  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • ms
    Tiny millisecond conversion utility
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • mocha
    simple, flexible, fun test framework
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • path
  • 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.
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • mongodb
    The official MongoDB driver for Node.js
  • Top PhpStorm 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