UNPKG

@dbp-topics/library

Version:

[GitLab Repository](https://gitlab.tugraz.at/dbp/library/library) | [npmjs package](https://www.npmjs.com/package/@dbp-topics/library) | [Unpkg CDN](https://unpkg.com/browse/@dbp-topics/library/)

25 lines (21 loc) 571 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; } } }; export function getPersonDisplayName(person) { return `${person.givenName} ${person.familyName}`; }