UNPKG

semantic-network

Version:

A utility library for manipulating a list of links that form a semantic interface to a network of resources.

18 lines 689 B
import { instanceOfLinkedRepresentation } from 'semantic-link'; import { instanceOfForm } from './instanceOfForm'; export function instanceOfFeed(object) { // TODO: perhaps also check from feedOnly state if (instanceOfLinkedRepresentation(object)) { const asObject = object; if ((asObject && Array.isArray(asObject.items) && !instanceOfForm(object))) { const { items } = asObject; const [first] = items; // naive check that the items has an 'id' in it if (first !== undefined && 'id' in first) { return true; } } } return false; } //# sourceMappingURL=instanceOfFeed.js.map