
package.es.dereference.util.mjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apidom-reference Show documentation
Show all versions of apidom-reference Show documentation
Advanced algorithms for semantic ApiDOM manipulations like dereferencing or resolution.
import { isElement } from '@swagger-api/apidom-core';
// eslint-disable-next-line import/prefer-default-export
export class AncestorLineage extends Array {
includesCycle(element) {
return this.filter(ancestors => ancestors.has(element)).length > 1;
}
includes(searchElement, fromIndex) {
if (searchElement instanceof Set) {
return super.includes(searchElement, fromIndex);
}
return this.some(ancestors => ancestors.has(searchElement));
}
findItem(predicate) {
for (const set of this) {
for (const item of set) {
if (isElement(item) && predicate(item)) {
return item;
}
}
}
return undefined;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy