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

How to use
sortBy
function
in
LoDashStatic

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

origin: lando/lando

// This is a helper to take object data and break it into rows
 add(data, {joiner = this.joiner, sort = this.sort} = {}) {
  _.forEach(sort ? _.sortBy(_.keys(data)) : _.keys(data), key => {
   // Do some special things for arrays
   if (_.isArray(data[key])) data[key] = data[key].join(joiner);
   // Do something special for objects
   if (_.isObject(data[key])) data[key] = util.inspect(data[key], {compact: true});
   // Do the normal push
   this.push([(chalk[this.keyColor](_.toUpper(key))), data[key]]);
  });
 }
origin: FormidableLabs/nodejs-dashboard

const slowFunc = function (count) {
 const begin = Date.now();

 // Deliberately unused variable.
 // eslint-disable-next-line no-unused-vars
 let values = _.times(count, () => _.random(0, count));
 values = _.sortBy(values);

 return Date.now() - begin;
}
origin: lando/lando

// Helper to retrieve all github repoz
const getAllRepos = (resolve, reject, slugs = []) => (err, res) => {
 // resolve([{name: 'seseg'}])
 if (err) reject(err);
 // Add previous data to current
 slugs = slugs.concat(_.map(res.data, site => ({name: site.full_name, value: site.ssh_url})));
 // IF we have more pages lets add them
 if (github.hasNextPage(res)) {
  return github.getNextPage(res, getAllRepos(resolve, reject, slugs));
 // Return if we are done
 } else {
  resolve(_.sortBy(slugs, 'name'));
 }
}
origin: lando/lando

lando.Promise.try(() => {
 if (_.isEmpty(inquiry)) return {};
 else {
  const inquirer = require('inquirer');
  inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'));
  // Try to rebuild the inquiry if this is app level bootstrap and we have an app
  if (!_.isEmpty(argv._app) && lando._bootstrap === 'app') {
   // NOTE: We need to clone deep here otherwise any apps with interactive options get 2x all their events
   // NOTE: Not exactly clear on why app here gets conflated with the app returned from lando.getApp
   const app = _.cloneDeep(lando.getApp(argv._app.root));
   return app.init().then(() => {
    inquiry = exports.getInteractive(_.find(app.tasks.concat(lando.tasks), {command: command}).options, argv);
    return inquirer.prompt(_.sortBy(inquiry, 'weight'));
   });
  // Otherwise just run
  } else {
   inquiry = exports.getInteractive(_.find(lando.tasks, {command: command}).options, argv);
   return inquirer.prompt(_.sortBy(inquiry, 'weight'));
  }
 }
})
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: lando/lando

const initSources = _(inits).filter(init => _.has(init, 'sources')).flatMap(init => init.sources).value();
lando.config.sources = _.sortBy(sources.concat(initSources), 'label');
lando.config.recipes = _.sortBy(_.map(inits, init => init.name), 'name');
lando.config.inits = inits;
origin: lando/lando

_.forEach(_.sortBy(tasks, 'command'), task => {
 if (_.has(task, 'handler')) yargs.command(task);
 else yargs.command(this.parseToYargs(task));
origin: welkinwong/nodercms

var categories = _.sortBy(source[0], 'sort');
var otherCategories = source[1];
   category.nodes = loop(_.sortBy(source[0], 'sort'));
origin: welkinwong/nodercms

});
var categories = _.sortBy(source[0], 'sort');
var otherCategories = source[1];
   category.node = _.map(_.sortBy(source[0], 'sort'), '_id');
origin: welkinwong/nodercms

var categories = _.sortBy(source[0], 'sort');
var otherCategories = source[1];
   category.nodes = loop(_.sortBy(source[0], 'sort'));
origin: torreyleonard/algotrader

/**
   * Creates a new OptionsChain object.
   * @author Torrey Leonard <https://github.com/Ladinn>
   * @param {Array} array
   */
  constructor(array) {
    this.array = _.sortBy(array, "date");
  }
origin: leossnet/jetcalc

self.Params(_.sortBy(_.map(_.filter(Params,{IsShow:true}),function(P){
       if (!CodeReport || Initial) P.InitParamSet = P.CodeParamSet;
       if (Override[P.CodeParam]){
         P.NewCodeParamSet = Override[P.CodeParam];
         P.CodeParamSet = Override[P.CodeParam];
       } else {
         P.CodeParamSet = P.InitParamSet;
         P.NewCodeParamSet = P.InitParamSet;
       }
       return _.merge(P,{IsChanged:ko.observable(false)});
     }),"IndexParam"));
origin: leossnet/jetcalc

var _parentsWithNode =  function(node,tree){
      return _.sortBy(_.filter(_.values(tree),function(check){
        return check.lft <= node.lft && check.rgt >= node.rgt; 
      }),"rgt");
    }
origin: zhouningyi/exchanges

getApiSummary() {
  const res = _.map(this.apiMap);
  this.mergeLockFns(res);
  return _.sortBy(res, d => -d.resp_time);
 }
origin: leossnet/jetcalc

_.sortBy(_.map(
   _.filter(
    ModuleManager.ModulesConfigs,
    function(M) {
     return M.config.places && M.config.places[type];
    }), "config"), "sort_index")
lodash(npm)LoDashStaticsortBy

JSDoc

Creates an array of elements, sorted in ascending order by the results of
running each element in a collection through each iteratee. This method
performs a stable sort, that is, it preserves the original sort order of
equal elements. The iteratees are 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

  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • ms
    Tiny millisecond conversion utility
  • express
    Fast, unopinionated, minimalist web framework
  • semver
    The semantic version parser used by npm.
  • fs
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • glob
    a little globber
  • chalk
    Terminal string styling done right
  • 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