import { ts } from 'ts-morph' ; export class JsDocHelper { public hasJSDocInternalTag ( filename , sourceFile , node ) { if ( typeof sourceFile . statements !== 'undefined' ) { return this . checkStatements ( sourceFile . statements , node ) ; } return false ; } private checkStatements ( statements , node ) { return statements . some ( x => this . checkStatement ( x , node ) ) ; } private checkStatement ( statement , node ) { if ( statement . pos === node . pos && statement . end === node . end ) { if ( node . jsDoc && node . jsDoc . length > 0 ) { return this . checkJsDocs ( node . jsDoc ) ; } } return false ; } private checkJsDocs ( jsDocs ) { return jsDocs . filter ( x => x . tags && x . tags . length > 0 ) . some ( x => this . checkJsDocTags ( x . tags ) ) ; } private checkJsDocTags ( tags ) { return tags . some ( x => x . tagName && x . tagName . text === 'internal' ) ; } }