Skip to content

Instantly share code, notes, and snippets.

@aboudard
Created November 30, 2021 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aboudard/3107120cb23e035b321b4641be43c8b9 to your computer and use it in GitHub Desktop.
Save aboudard/3107120cb23e035b321b4641be43c8b9 to your computer and use it in GitHub Desktop.
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