Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function findConstructs(node: Node, files: string[], parent?: Reflection) {
if (parent) {
node.parent = parent;
}
// Global = 0, ExternalModule = 1
if (
node.kind === ReflectionKind.Global ||
node.kind === ReflectionKind.ExternalModule
) {
let children = node.children;
if (children && children.length > 0) {
children.forEach(function(child) {
findConstructs(child, files, node);
});
}
} else {
if (
(node.kind === ReflectionKind.Class ||
node.kind === ReflectionKind.Interface ||
node.kind === ReflectionKind.TypeAlias ||
node.kind === ReflectionKind.ObjectLiteral ||
node.kind === ReflectionKind.Module ||
node.kind === ReflectionKind.Variable ||
node.kind === ReflectionKind.Enum ||
function getQualifiedName(node: Node) {
const names: string[] = [];
let current: Reflection | undefined = node;
while (current) {
if (
current.kind === ReflectionKind.Global ||
current.kind === ReflectionKind.ExternalModule
) {
// Skip global/external module nodes
break;
}
const index = current.name.lastIndexOf('.');
const name =
index === -1 ? current.name : current.name.substring(index + 1);
// Check static methods/properties
if (
current.kind === ReflectionKind.Method ||
current.kind === ReflectionKind.Property
) {
if (current.flags.isStatic) {
names.unshift(name);
} else {
function findConstructs(node: Node, files: string[], parent?: Reflection) {
if (parent) {
node.parent = parent;
}
// Global = 0, ExternalModule = 1
if (
node.kind === ReflectionKind.Global ||
node.kind === ReflectionKind.ExternalModule
) {
let children = node.children;
if (children && children.length > 0) {
children.forEach(function(child) {
findConstructs(child, files, node);
});
}
} else {
if (
(node.kind === ReflectionKind.Class ||
node.kind === ReflectionKind.Interface ||
node.kind === ReflectionKind.TypeAlias ||
node.kind === ReflectionKind.ObjectLiteral ||
node.kind === ReflectionKind.Module ||
node.kind === ReflectionKind.Variable ||
node.kind === ReflectionKind.Enum ||
function getNavigationGroup(reflection: DeclarationReflection) {
if (reflection.kind === ReflectionKind.ExternalModule) {
return externalModulesNavigation;
}
if (reflection.kind === ReflectionKind.Module) {
return modulesNavigation;
}
if (reflection.kind === ReflectionKind.Class) {
return classesNavigation;
}
if (reflection.kind === ReflectionKind.Enum) {
return enumsNavigation;
}
if (reflection.kind === ReflectionKind.Interface) {
return interfacesNavigation;
}
return null;
}
private externalModulesWithoutTestsAndMocks(projectReflection: ProjectReflection): DeclarationReflection[] {
return projectReflection.getChildrenByKind(ReflectionKind.ExternalModule)
.filter((m) => !m.name.endsWith('.mock"') && !m.name.endsWith('.test"'));
}