Created
April 9, 2017 11:35
-
-
Save bekatom/7a178f0bd214e2db193a9a66f5e90dc7 to your computer and use it in GitHub Desktop.
createAlphabetSorting with lodash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash' | |
/** | |
* Create Alpavet data structure from list of objects like : [ A : {}, B : {}] | |
* @param {*} list | |
*/ | |
export const createAlphabetSorting = list => | |
_.groupBy( | |
_.sortBy(list, [i => i.firstName.toLowerCase()]), | |
item => item.firstName.charAt(0).toUpperCase()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment