From 5249ac55c556a1dfdd32e845ee0d1fcf75fa412a Mon Sep 17 00:00:00 2001 From: Phillip Zada Date: Wed, 20 Sep 2017 09:20:55 +1000 Subject: [PATCH] #405 selectId as optional --- modules/entity/src/create_adapter.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/entity/src/create_adapter.ts b/modules/entity/src/create_adapter.ts index ebb2304d7c..c51f85295f 100644 --- a/modules/entity/src/create_adapter.ts +++ b/modules/entity/src/create_adapter.ts @@ -10,14 +10,15 @@ import { createSelectorsFactory } from './state_selectors'; import { createSortedStateAdapter } from './sorted_state_adapter'; import { createUnsortedStateAdapter } from './unsorted_state_adapter'; -export function createEntityAdapter(options?: { - selectId: IdSelector; - sortComparer?: false | Comparer; -}): EntityAdapter { - options = options || { selectId: (instance: any) => instance.id }; - +export function createEntityAdapter( + options: { + selectId?: IdSelector; + sortComparer?: false | Comparer; + } = {} +): EntityAdapter { const { selectId, sortComparer }: EntityDefinition = { sortComparer: false, + selectId: (instance: any) => instance.id, ...options, };