Skip to Content
APIPlanning Center People TSSrcFunctionsFunction: createIncludedLookup()

planning-center-monorepo v1.0.0


planning-center-monorepo / planning-center-people-ts/src / createIncludedLookup

Function: createIncludedLookup()

createIncludedLookup(included): Map<string, ResourceObject<string, any, any>>

Defined in: packages/planning-center-people-ts/src/helpers.ts:956 

Create a lookup map for included resources by type and id

This is more efficient than calling findIncluded() multiple times.

Parameters

included

ResourceObject<string, any, any>[]

Array of included resources from JSON:API response

Returns

Map<string, ResourceObject<string, any, any>>

Map with key format “type:id” -> resource object

@gmail.com

const person = await client.people.getPage({ include: ['emails', 'phone_numbers'] }); const lookup = createIncludedLookup(person.included); const email = lookup.get('Email:456'); // Fast lookup