How to use the lodash-es.sortBy function in lodash-es

To help you get started, we’ve selected a few lodash-es examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openshift / console / frontend / public / components / catalog / catalog-page.tsx View on Github external
}

    // Templates are not passed as a Firehose item since we only request template metadata.
    if (projectTemplateMetadata) {
      projectTemplateItems = this.normalizeTemplates(projectTemplateMetadata);
    }

    const items = [
      ...clusterServiceClassItems,
      ...imageStreamItems,
      ...templateItems,
      ...extensionItems,
      ...projectTemplateItems,
    ];

    return _.sortBy(items, 'tileName');
  }
github virtool / virtool / client / src / js / analyses / components / List.js View on Github external
render() {
        // The content that will be shown below the "New Analysis" form.
        let listContent;

        if (this.props.analyses.length) {
            // The components that detail individual analyses.
            listContent = map(sortBy(this.props.analyses, "created_at").reverse(), (document, index) => (
                
            ));
        } else {
            listContent = ;
        }

        return (
            <div>
                
                
                {listContent}

                 this.setState({ show: false })}</div>
github Addepar / ember-charts / addon / components / pie-chart.js View on Github external
var detectDenseSmallSlices = function (finishedData) {
      // This constant determines how many slices to use to calculate the
      // average small slice percentage. The smaller the constant, the more it
      // focuses on the smallest slices within the pie.
      //
      // Empirically, using a sample size of 2 works very well.
      var smallSliceSampleSize = 2;

      var sortedData = sortBy(finishedData, "percent");
      var startIndex = 0;
      var endIndex = Math.min(smallSliceSampleSize, sortedData.length);
      var largestSlicePercent = last(sortedData).percent;

      var averageSmallSlicesPercent = sortedData.slice(startIndex, endIndex).reduce(function(p,d) {
        return d.percent / (endIndex - startIndex) + p;
      }, 0);

      // When slices smaller than 2.75 percent are concentrated in any location,
      // there is a high probability of label intersections.
      //
      // However, empirical label intersect evidence has demonstrated that this
      // threshold must be increased to 5% when there are multiple small slices
      // from the 5 o'clock to 7 o'clock positions
      if (averageSmallSlicesPercent &lt;= 2.75) {
        return true;
github Sunbird-Ed / SunbirdEd-portal / src / app / client / projects / desktop / src / app / modules / offline / components / desktop-prominent-filter / desktop-prominent-filter.component.ts View on Github external
category: 'channel',
                                identifier: value.hashTagId,
                                name: value.orgName,
                            };
                        });
                    } else {
                        const frameworkTerms = _.get(_.find(this.categoryMasterList, { code: formFieldCategory.code }), 'terms');
                        formFieldCategory.range = _.union(formFieldCategory.range, frameworkTerms);
                    }
                    if (this.selectedLanguage !== 'en') {
                        formFieldCategory = this.utilService.translateLabel(formFieldCategory, this.selectedLanguage);
                        formFieldCategory.range = this.utilService.translateValues(formFieldCategory.range, this.selectedLanguage);
                    }
                    return true;
                });
                formFieldProperties = _.sortBy(_.uniqBy(formFieldProperties, 'code'), 'index');
                return formFieldProperties;
            }));
    }
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / search / components / user-filter / user-filter.component.ts View on Github external
sortAndCapitaliseFilters (object) {
    return _.sortBy(object, [(sort) => {
      return sort.name = _.capitalize(sort.name); }]);
  }
github archivist / archivist / packages / resources / ResourcesContext.js View on Github external
getEntries() {
    let editorSession = this.context.editorSession
    let resources = editorSession.resources
    let entries = sortBy(resources, ['entityType', 'name'])
    return entries
  }
github gatsbyjs / gatsby / www / src / pages / docs / node-api-helpers.js View on Github external
render() {
    const docs = sortBy(
      this.props.data.allDocumentationJs.edges.map(({ node }) =&gt; node),
      docs =&gt; docs.name
    )
    return (
      
        
          
            <title>Node API helpers</title>
            
          
          <h1 id="gatsby-node-helpers-apis">
            Gatsby Node API helpers
          </h1>
github raindropio / mobile / src / data / sagas / collections / items.js View on Github external
function* saveOrder() {
	try {
		const state = yield select()

		yield all(
			_.map(
				_.sortBy(
					_.filter(
						state.collections.items,
						(item)=>item.parentId?true:false
					),
					({sort})=>sort
				),

				(item, index)=>(
					put({
						type: COLLECTION_UPDATE_REQ,
						_id: item._id,
						set: {
							sort: parseInt(index)
						}
					})
				)