Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

for (... in ...) statements must be filtered with an if statement (forin)

function isFiltered({statements}: ts.Block): boolean {
    switch (statements.length) {
        case 0: return true;
        case 1: return statements[0].kind === ts.SyntaxKind.IfStatement;
        default:
            return statements[0].kind === ts.SyntaxKind.IfStatement && nodeIsContinue((statements[0] as ts.IfStatement).thenStatement);
    }

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #statements #filtered #statement
ADD COMMENT
Topic
Name
1+7 =