Codota Logo For Javascript
LoDashStatic.uniqBy
Code IndexAdd Codota to your IDE (free)

How to use
uniqBy
function
in
LoDashStatic

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

origin: lando/lando

/*
  * Create a data source
  */
 create(source, data = {}, sort = []) {
  let database = this.read(source);
  database.push(_.merge({}, data, {id: hasher(data)}));
  // Sort if we have to
  if (!_.isEmpty(sort)) database = _.orderBy(database, ...sort);
  // Dump results
  this.yaml.dump(path.resolve(this.base, `${source}.yml`), _.uniqBy(database, 'id'));
  return this.read(source, {id: hasher(data)});
 }
origin: moleculerjs/moleculer

/**
   * Get all endpoints for event
   *
   * @param {String} eventName
   * @param {Array<String>?} groupNames
   * @returns
   * @memberof EventCatalog
   */
  getAllEndpoints(eventName, groupNames) {
    const res = [];
    this.events.forEach(list => {
      if (!utils.match(eventName, list.name)) return;
      if (groupNames == null || groupNames.length == 0 || groupNames.indexOf(list.group) !== -1) {
        list.endpoints.forEach(ep => {
          if (ep.isAvailable)
            res.push(ep);
        });
      }
    });

    return _.uniqBy(res, "id");
  }
origin: shen100/mili

async create(createDraftDto: CreateDraftDto, userID: number) {
    const uniqCates = _.uniqBy(createDraftDto.categories, (c) => c.id);
    const categories: Category[] = uniqCates.map(cate => {
      const c = new Category();
      return c;
    });
    const uniqTags = _.uniqBy(createDraftDto.tags, (t) => t.id);
    const tags: Tag[] = uniqTags.map(t => {
      const tag = new Tag();
origin: lando/lando

/*
  * Get list of sites
  */
 getSites() {
  // Call to get user sites
  const pantheonUserSites = () => {
   const getSites = ['users', _.get(this.session, 'user_id'), 'memberships', 'sites'];
   return pantheonRequest(this.request, this.log, 'get', getSites, {params: {limit: MAX_SITES}})
   .then(sites => _.map(sites, (site, id) => _.merge(site, site.site)));
  };
  // Call to get org sites
  const pantheonOrgSites = () => {
   const getOrgs = ['users', _.get(this.session, 'user_id'), 'memberships', 'organizations'];
   return pantheonRequest(this.request, this.log, 'get', getOrgs)
   .map(org => {
    if (org.role !== 'unprivileged') {
     const getOrgsSites = ['organizations', org.id, 'memberships', 'sites'];
     return pantheonRequest(this.request, this.log, 'get', getOrgsSites, {params: {limit: MAX_SITES}})
     .map(site => _.merge(site, site.site));
    }
   })
   .then(sites => _.flatten(sites));
  };
  // Run both requests
  return Promise.all([pantheonUserSites(), pantheonOrgSites()])
  // Combine, cache and all the things
  .then(sites => _.compact(_.sortBy(_.uniqBy(_.flatten(sites), 'name'), 'name')))
  // Filter out any BAAAAD BIZZZNIZZZ
  .filter(site => !site.frozen);
 }
origin: tumobi/nideshop

list.data = _.map(_.uniqBy(list.data, function(item) {
 return item.goods_id;
}), (item) => {
origin: yeshimei/ntbl-ga

function addStar (name, star) {
 const categories = getCategory()
 const category = categories.find(category => category.name === name)
 if (category) {
  category.stars.push(...star)
  category.stars = _.uniqBy(category.stars, 'id')
  setCategory(categories)
 }
}
origin: holidayextras/jsonapi-server

includePP._arrayToTree(request, includes, filters, (attErr, includeTree) => {
  if (attErr) return callback(attErr)

  let dataItems = response.data
  if (!(Array.isArray(dataItems))) dataItems = [ dataItems ]
  includeTree._dataItems = dataItems

  includePP._fillIncludeTree(includeTree, request, fiErr => {
   if (fiErr) return callback(fiErr)

   includeTree._dataItems = [ ]
   response.included = includePP._getDataItemsFromTree(includeTree)
   response.included = _.uniqBy(response.included, someItem => `${someItem.type}~~${someItem.id}`)

   return callback()
  })
 })
origin: und3fined-v01d/hydrabot

const findReviewersByState = (reviews, state) => {
 // filter out review submitted comments because it does not nullify an approved state.
 // Other possible states are PENDING and REQUEST_CHANGES. At those states the user has not approved the PR.
 // See https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request
 // While submitting a review requires the states be PENDING, REQUEST_CHANGES, COMMENT and APPROVE
 // The payload actually returns the state in past tense: i.e. APPROVED, COMMENTED
 const relevantReviews = reviews.filter(element => element.state.toLowerCase() !== 'commented')

 // order it by date of submission. The docs says the order is chronological but we sort it so that
 // uniqBy will extract the correct last submitted state for the user.
 const ordered = _.orderBy(relevantReviews, ['submitted_at'], ['desc'])
 const uniqueByUser = _.uniqBy(ordered, 'user.login')

 // approved reviewers are ones that are approved and not nullified by other submissions later.
 return uniqueByUser
  .filter(element => element.state.toLowerCase() === state)
  .map(review => review.user && review.user.login)
}
origin: APIDevTools/swagger-express-middleware

_.uniqBy(operationParams.concat(pathParams), (param) => {
  return param.name + param.in;
 })
origin: bq/bitbloq-backend

Board.find({})
    .where('uuid').in(integratedBoardsUuids)
    .select('-__v')
    .exec(function(err, boards) {
      if (err) {
        next(err);
      } else if (boards.length > 0) {
        boards.forEach(function(board) {
          board.integratedComponents = _.concat(board.integratedComponents, integratedBoards[board.uuid]);
          board.integratedComponents = _.uniqBy(board.integratedComponents, 'uid');
          board.save(next);
        });
      } else {
        next(err);
      }
    });
origin: Ghost---Shadow/unit-test-recorder

const FunctionImportStatements = ({ exportedFunctions, packagedArguments }) => {
 const importedFunctions = Object.keys(exportedFunctions);
 // Functions in objects have names like obj.fun1, obj.fun2
 const cleanImportedFunctions = _.uniqBy(
  importedFunctions.map(name => ({
   identifier: name.split('.')[0],
   meta: exportedFunctions[name].meta,
  })),
  'identifier',
 );
 const importStatements = cleanImportedFunctions.map(({ identifier, meta }) => {
  const { isDefault, isEcmaDefault, importPath } = meta;
  const props = { identifier, importPath, packagedArguments };
  if (isEcmaDefault) return EcmaDefaultImportStatement(props);
  if (isDefault) return DefaultImportStatement(props);
  return DestructureImportStatement(props);
 });

 return importStatements.join('\n');
}
origin: simionrobert/BitInsight

var torrent = {};
torrent.infohash = infohash;
torrent.listIP = _.uniqBy(this.listIP, function (e) {
  return e.host + e.port
})
origin: BukaLelang/bukalelang-backend

})
let uniqBidder = _.uniqBy(removedThatBidder, 'userId')
origin: yeshimei/ntbl-ga

function addStar (name, star) {
 const categories = getCategory()
 const category = categories.find(category => category.name === name)
 if (category) {
  category.stars.push(...star)
  category.stars = _.uniqBy(category.stars, 'id')
  setCategory(categories)
 }
}
origin: jagql/framework

includePP._arrayToTree(request, includes, filters, (attErr, includeTree) => {
  if (attErr) return callback(attErr)

  let dataItems = response.data
  if (!(Array.isArray(dataItems))) dataItems = [ dataItems ]
  includeTree._dataItems = dataItems

  includePP._fillIncludeTree(includeTree, request, fiErr => {
   if (fiErr) return callback(fiErr)

   includeTree._dataItems = [ ]
   response.included = includePP._getDataItemsFromTree(includeTree)
   response.included = _.uniqBy(response.included, someItem => `${someItem.type}~~${someItem.id}`)

   return callback()
  })
 })
lodash(npm)LoDashStaticuniqBy

JSDoc

This method is like `_.uniq` except that it accepts `iteratee` which is
invoked for each element in `array` to generate the criterion by which
uniqueness is computed. The iteratee is invoked with one argument: (value).

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

  • aws-sdk
    AWS SDK for JavaScript
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • postcss
  • chalk
    Terminal string styling done right
  • http
  • glob
    a little globber
  • request
    Simplified HTTP request client.
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • colors
    get colors in your node.js console
  • 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