How to use the esprima.Syntax.AssignmentPattern 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 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));
        }
    }, []);
}
github yanhaijing / template.js / packages / precompiler / src / index.ts View on Github external
return node.properties.reduce((prev, property): string[] => {
        const value = property.value;
        if (value.type === Syntax.Identifier) {
            return prev.concat(getIdentifierName(value));
        }
        if (value.type === Syntax.AssignmentPattern) {
            return prev.concat(getAssignmentPatternName(value));
        }
        if (value.type === Syntax.ArrayPattern) {
            return prev.concat(getArrayPatternName(value));
        }
        if (value.type === Syntax.ObjectPattern) {
            return prev.concat(getObjectPatternName(value));
        }
    }, []);
}