source: node_modules/@swagger-api/apidom-reference/cjs/dereference/util.cjs

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 808 bytes
Line 
1"use strict";
2
3exports.__esModule = true;
4exports.AncestorLineage = void 0;
5var _apidomCore = require("@swagger-api/apidom-core");
6// eslint-disable-next-line import/prefer-default-export
7class AncestorLineage extends Array {
8 includesCycle(element) {
9 return this.filter(ancestors => ancestors.has(element)).length > 1;
10 }
11 includes(searchElement, fromIndex) {
12 if (searchElement instanceof Set) {
13 return super.includes(searchElement, fromIndex);
14 }
15 return this.some(ancestors => ancestors.has(searchElement));
16 }
17 findItem(predicate) {
18 for (const set of this) {
19 for (const item of set) {
20 if ((0, _apidomCore.isElement)(item) && predicate(item)) {
21 return item;
22 }
23 }
24 }
25 return undefined;
26 }
27}
28exports.AncestorLineage = AncestorLineage;
Note: See TracBrowser for help on using the repository browser.