UNPKG

@digital-blueprint/lunchlottery-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/lunchlottery-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/lunchlottery-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/lunchlottery-app/)

21 lines (18 loc) 466 B
/** * Finds an object in a JSON result by identifier * * @param identifier * @param results * @param identifierAttribute */ export const findObjectInApiResults = (identifier, results, identifierAttribute = '@id') => { const members = results['hydra:member']; if (members === undefined) { return; } for (const object of members) { if (object[identifierAttribute] === identifier) { return object; } } };