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

How to use
compact
function
in
lodash

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

origin: kitze/JSUI

get groupsWithProjects() {
   const groupedProjects = groupBy(self.filteredProjects, p => (p.group ? p.group.id : 'other'));

   return compact(
    [...self.filteredGroups].map(group => {
     if (!group) {
      return null;
     }
     return {
      ...group,
      projects: groupedProjects[group.id] || []
     };
    })
   );
  }
origin: benjamincanac/imperium

/**
  * Check if action matches any of user roles action
  *
  * @param name Name of the action
  * @param params Params of the action
  *
  * @return {boolean}
  */
 async can (name, params) {
  const routeAction = { name, ...params }

  // Transform imperium stored roles object into an array with only matching action
  const roles = compact(map(this.imperium._roles, ({ process, actions }, role) => {
   const action = find(actions, { name })
   if (!action) return null

   return {
    role,
    action,
    process
   }
  }))

  for (const role of roles) {
   /* istanbul ignore else */
   if (await this._roleMatchRouteAction(role, routeAction)) return true
  }

  return false
 }
origin: zetekla/react-diff-view

  language: language,
  oldSource: oldSource,
  enhancers: compact(enhancers)
};
origin: brantburnett/couchbase-index-manager

let mutations = compact(flatten(
  definitions.map((definition) => Array.from(definition.getMutations(
    mutationContext)))));
origin: intelligo-io/neuro

}, this);
dataset = compact(dataset);
lodash(npm)compact

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

  • http
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • 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.
  • js-yaml
    YAML 1.2 parser and serializer
  • ms
    Tiny millisecond conversion utility
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • async
    Higher-order functions and common patterns for asynchronous code
  • path
  • Top Sublime Text 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