Created
November 30, 2021 17:10
-
-
Save aboudard/3107120cb23e035b321b4641be43c8b9 to your computer and use it in GitHub Desktop.
This file contains 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 { EntityMetadataMap } from '@ngrx/data'; | |
/** | |
* Compare function for Entities sort | |
* @param {string} a | |
* @param {string} b | |
* @returns {number} | |
*/ | |
export function sortByTitle( | |
a: { title: string }, | |
b: { title: string } | |
): number { | |
return a.title.localeCompare(b.title); | |
} | |
const entityMetadata: EntityMetadataMap = { | |
Todo: { | |
sortComparer: sortByTitle | |
} | |
}; | |
export const entityConfig = { | |
entityMetadata | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment