UNPKG

@siren-js/client

Version:
15 lines (14 loc) 504 B
import { follow } from './follow'; import { EmbeddedLink } from './models'; import { parse } from './parse'; /** * Resolves a {@linkcode SubEntity} to an {@linkcode Entity}. An * `EmbeddedEntity` is returned as is, while an {@linkcode EmbeddedLink} is * {@linkcode follow | followed} and {@linkcode parse | parsed}. */ export async function resolve(subEntity) { if (subEntity instanceof EmbeddedLink) { return follow(subEntity).then(parse); } return Promise.resolve(subEntity); }