UNPKG

semantic-network

Version:

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

38 lines 1.37 kB
"use strict"; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.instanceOfFeed = void 0; var semantic_link_1 = require("semantic-link"); var instanceOfForm_1 = require("./instanceOfForm"); function instanceOfFeed(object) { // TODO: perhaps also check from feedOnly state if ((0, semantic_link_1.instanceOfLinkedRepresentation)(object)) { var asObject = object; if ((asObject && Array.isArray(asObject.items) && !(0, instanceOfForm_1.instanceOfForm)(object))) { var items = asObject.items; var _a = __read(items, 1), first = _a[0]; // naive check that the items has an 'id' in it if (first !== undefined && 'id' in first) { return true; } } } return false; } exports.instanceOfFeed = instanceOfFeed; //# sourceMappingURL=instanceOfFeed.js.map