Creating Single Instance Criteria Queries in Typescript

Image by Gerd Altmann from Pixabay

Scenario

Approach

function findDocumentByIdAndSummary(
id: string,
summaryQuery: string): Document | undefined {
return DOCUMENTS.
find( doc => doc.id === id
&& doc.summary.includes(summaryQuery))
}

Demo

Brought to you By

Founder of Firefly Semantics Corporation