How to use the esprima.Syntax.ArrayPattern function in esprima

To help you get started, we’ve selected a few esprima examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yanhaijing / template.js / packages / precompiler / src / index.ts View on Github external
return params.reduce((prev, param): string[] => {
        if (param.type === Syntax.Identifier) {
            return prev.concat(getIdentifierName(param));
        }
        if (param.type === Syntax.AssignmentPattern) {
            return prev.concat(getAssignmentPatternName(param));
        }
        if (param.type === Syntax.ArrayPattern) {
            return prev.concat(getArrayPatternName(param));
        }
        if (param.type === Syntax.ObjectPattern) {
            return prev.concat(getObjectPatternName(param));
        }
        if (param.type === Syntax.RestElement) {
            return prev.concat(getRestElementName(param));
        }
    }, []);
}
github yanhaijing / template.js / packages / precompiler / src / index.ts View on Github external
return node.elements.reduce((prev, element): string[] => {
        if (element.type === Syntax.Identifier) {
            return prev.concat(getIdentifierName(element));
        }
        if (element.type === Syntax.AssignmentPattern) {
            return prev.concat(getAssignmentPatternName(element));
        }
        if (element.type === Syntax.ArrayPattern) {
            return prev.concat(getArrayPatternName(element));
        }
        if (element.type === Syntax.ObjectPattern) {
            return prev.concat(getObjectPatternName(element));
        }
        if (element.type === Syntax.RestElement) {
            return prev.concat(getRestElementName(element));
        }
    }, []);
}