main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
808 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports.AncestorLineage = void 0;
|
---|
| 5 | var _apidomCore = require("@swagger-api/apidom-core");
|
---|
| 6 | // eslint-disable-next-line import/prefer-default-export
|
---|
| 7 | class 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 | }
|
---|
| 28 | exports.AncestorLineage = AncestorLineage; |
---|
Note:
See
TracBrowser
for help on using the repository browser.