Skip to main content

Module pattern

Module pattern 

Source
Expand description

A pattern binding or assignment node.

A Pattern Corresponds to the BindingPattern and the AssignmentPattern nodes, each of which is used in different situations and have slightly different grammars. For example, a variable declaration combined with a destructuring expression is a BindingPattern:

const obj = { a: 1, b: 2 };
const { a, b } = obj; // BindingPattern

On the other hand, a simple destructuring expression with already declared variables is called an AssignmentPattern:

let a = 1;
let b = 3;
[a, b] = [b, a]; // AssignmentPattern

Structs§

ArrayPattern
An array binding or assignment pattern.
ObjectPattern
An object binding or assignment pattern.

Enums§

ArrayPatternElement
The different types of bindings that an array binding pattern may contain.
ObjectPatternElement
The different types of bindings that an ObjectPattern may contain.
Pattern
An object or array pattern binding or assignment.