hermes-estree 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/predicates.js +293 -283
- package/dist/generated/predicates.js.flow +289 -283
- package/dist/predicates.js +19 -19
- package/dist/predicates.js.flow +19 -19
- package/package.json +1 -1
package/dist/predicates.js
CHANGED
|
@@ -99,7 +99,7 @@ Object.keys(_predicates).forEach(function (key) {
|
|
|
99
99
|
function isClass(node
|
|
100
100
|
/*: ESNode */
|
|
101
101
|
)
|
|
102
|
-
/*: node is (ClassDeclaration | ClassExpression) */
|
|
102
|
+
/*: implies node is (ClassDeclaration | ClassExpression) */
|
|
103
103
|
{
|
|
104
104
|
return node.type === 'ClassDeclaration' || node.type === 'ClassExpression';
|
|
105
105
|
}
|
|
@@ -107,7 +107,7 @@ function isClass(node
|
|
|
107
107
|
function isPropertyDefinitionWithNonComputedName(node
|
|
108
108
|
/*: ESNode */
|
|
109
109
|
)
|
|
110
|
-
/*: node is PropertyDefinitionWithNonComputedName */
|
|
110
|
+
/*: implies node is PropertyDefinitionWithNonComputedName */
|
|
111
111
|
{
|
|
112
112
|
return node.type === 'PropertyDefinition' && node.computed === false;
|
|
113
113
|
}
|
|
@@ -115,7 +115,7 @@ function isPropertyDefinitionWithNonComputedName(node
|
|
|
115
115
|
function isClassMember(node
|
|
116
116
|
/*: ESNode */
|
|
117
117
|
)
|
|
118
|
-
/*: node is ClassMember */
|
|
118
|
+
/*: implies node is ClassMember */
|
|
119
119
|
{
|
|
120
120
|
return node.type === 'PropertyDefinition' || node.type === 'MethodDefinition';
|
|
121
121
|
}
|
|
@@ -123,7 +123,7 @@ function isClassMember(node
|
|
|
123
123
|
function isClassMemberWithNonComputedName(node
|
|
124
124
|
/*: ESNode */
|
|
125
125
|
)
|
|
126
|
-
/*: node is (PropertyDefinitionWithNonComputedName | MethodDefinitionConstructor | MethodDefinitionWithNonComputedName) */
|
|
126
|
+
/*: implies node is (PropertyDefinitionWithNonComputedName | MethodDefinitionConstructor | MethodDefinitionWithNonComputedName) */
|
|
127
127
|
{
|
|
128
128
|
return (node.type === 'PropertyDefinition' || node.type === 'MethodDefinition') && node.computed === false;
|
|
129
129
|
}
|
|
@@ -131,7 +131,7 @@ function isClassMemberWithNonComputedName(node
|
|
|
131
131
|
function isComment(node
|
|
132
132
|
/*: ESNode | Token */
|
|
133
133
|
)
|
|
134
|
-
/*: node is (MostTokens | BlockComment | LineComment) */
|
|
134
|
+
/*: implies node is (MostTokens | BlockComment | LineComment) */
|
|
135
135
|
{
|
|
136
136
|
return node.type === 'Block' || node.type === 'Line';
|
|
137
137
|
}
|
|
@@ -139,7 +139,7 @@ function isComment(node
|
|
|
139
139
|
function isFunction(node
|
|
140
140
|
/*: ESNode */
|
|
141
141
|
)
|
|
142
|
-
/*: node is AFunction */
|
|
142
|
+
/*: implies node is AFunction */
|
|
143
143
|
{
|
|
144
144
|
return node.type === 'ArrowFunctionExpression' || node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression';
|
|
145
145
|
}
|
|
@@ -147,7 +147,7 @@ function isFunction(node
|
|
|
147
147
|
function isMethodDefinitionWithNonComputedName(node
|
|
148
148
|
/*: ESNode */
|
|
149
149
|
)
|
|
150
|
-
/*: node is (MethodDefinitionConstructor | MethodDefinitionWithNonComputedName) */
|
|
150
|
+
/*: implies node is (MethodDefinitionConstructor | MethodDefinitionWithNonComputedName) */
|
|
151
151
|
{
|
|
152
152
|
return node.type === 'MethodDefinition' && node.computed === false;
|
|
153
153
|
}
|
|
@@ -155,7 +155,7 @@ function isMethodDefinitionWithNonComputedName(node
|
|
|
155
155
|
function isMemberExpressionWithNonComputedProperty(node
|
|
156
156
|
/*: ESNode */
|
|
157
157
|
)
|
|
158
|
-
/*: node is MemberExpressionWithNonComputedName */
|
|
158
|
+
/*: implies node is MemberExpressionWithNonComputedName */
|
|
159
159
|
{
|
|
160
160
|
return node.type === 'MemberExpression' && node.computed === false;
|
|
161
161
|
}
|
|
@@ -163,7 +163,7 @@ function isMemberExpressionWithNonComputedProperty(node
|
|
|
163
163
|
function isOptionalMemberExpressionWithNonComputedProperty(node
|
|
164
164
|
/*: ESNode */
|
|
165
165
|
)
|
|
166
|
-
/*: node is MemberExpressionWithNonComputedName */
|
|
166
|
+
/*: implies node is MemberExpressionWithNonComputedName */
|
|
167
167
|
{
|
|
168
168
|
return node.type === 'MemberExpression' && node.computed === false;
|
|
169
169
|
}
|
|
@@ -171,7 +171,7 @@ function isOptionalMemberExpressionWithNonComputedProperty(node
|
|
|
171
171
|
function isObjectPropertyWithShorthand(node
|
|
172
172
|
/*: ESNode */
|
|
173
173
|
)
|
|
174
|
-
/*: node is (ObjectPropertyWithShorthandStaticName | DestructuringObjectPropertyWithShorthandStaticName) */
|
|
174
|
+
/*: implies node is (ObjectPropertyWithShorthandStaticName | DestructuringObjectPropertyWithShorthandStaticName) */
|
|
175
175
|
{
|
|
176
176
|
return node.type === 'Property' && node.shorthand === true;
|
|
177
177
|
}
|
|
@@ -179,7 +179,7 @@ function isObjectPropertyWithShorthand(node
|
|
|
179
179
|
function isObjectPropertyWithNonComputedName(node
|
|
180
180
|
/*: ESNode */
|
|
181
181
|
)
|
|
182
|
-
/*: node is (ObjectPropertyWithNonShorthandStaticName | ObjectPropertyWithShorthandStaticName | DestructuringObjectPropertyWithNonShorthandStaticName | DestructuringObjectPropertyWithShorthandStaticName) */
|
|
182
|
+
/*: implies node is (ObjectPropertyWithNonShorthandStaticName | ObjectPropertyWithShorthandStaticName | DestructuringObjectPropertyWithNonShorthandStaticName | DestructuringObjectPropertyWithShorthandStaticName) */
|
|
183
183
|
{
|
|
184
184
|
return node.type === 'Property' && node.computed === false;
|
|
185
185
|
}
|
|
@@ -187,7 +187,7 @@ function isObjectPropertyWithNonComputedName(node
|
|
|
187
187
|
function isBigIntLiteral(node
|
|
188
188
|
/*: ESNode */
|
|
189
189
|
)
|
|
190
|
-
/*: node is BigIntLiteral */
|
|
190
|
+
/*: implies node is BigIntLiteral */
|
|
191
191
|
{
|
|
192
192
|
return node.type === 'Literal' && node.literalType === 'bigint';
|
|
193
193
|
}
|
|
@@ -195,7 +195,7 @@ function isBigIntLiteral(node
|
|
|
195
195
|
function isBooleanLiteral(node
|
|
196
196
|
/*: ESNode */
|
|
197
197
|
)
|
|
198
|
-
/*: node is BooleanLiteral */
|
|
198
|
+
/*: implies node is BooleanLiteral */
|
|
199
199
|
{
|
|
200
200
|
return node.type === 'Literal' && node.literalType === 'boolean';
|
|
201
201
|
}
|
|
@@ -203,7 +203,7 @@ function isBooleanLiteral(node
|
|
|
203
203
|
function isNullLiteral(node
|
|
204
204
|
/*: ESNode */
|
|
205
205
|
)
|
|
206
|
-
/*: node is NullLiteral */
|
|
206
|
+
/*: implies node is NullLiteral */
|
|
207
207
|
{
|
|
208
208
|
return node.type === 'Literal' && node.literalType === 'null';
|
|
209
209
|
}
|
|
@@ -211,7 +211,7 @@ function isNullLiteral(node
|
|
|
211
211
|
function isNumericLiteral(node
|
|
212
212
|
/*: ESNode */
|
|
213
213
|
)
|
|
214
|
-
/*: node is NumericLiteral */
|
|
214
|
+
/*: implies node is NumericLiteral */
|
|
215
215
|
{
|
|
216
216
|
return node.type === 'Literal' && node.literalType === 'numeric';
|
|
217
217
|
}
|
|
@@ -219,7 +219,7 @@ function isNumericLiteral(node
|
|
|
219
219
|
function isRegExpLiteral(node
|
|
220
220
|
/*: ESNode */
|
|
221
221
|
)
|
|
222
|
-
/*: node is RegExpLiteral */
|
|
222
|
+
/*: implies node is RegExpLiteral */
|
|
223
223
|
{
|
|
224
224
|
return node.type === 'Literal' && node.literalType === 'regexp';
|
|
225
225
|
}
|
|
@@ -227,7 +227,7 @@ function isRegExpLiteral(node
|
|
|
227
227
|
function isStringLiteral(node
|
|
228
228
|
/*: ESNode */
|
|
229
229
|
)
|
|
230
|
-
/*: node is StringLiteral */
|
|
230
|
+
/*: implies node is StringLiteral */
|
|
231
231
|
{
|
|
232
232
|
return node.type === 'Literal' && node.literalType === 'string';
|
|
233
233
|
}
|
|
@@ -235,7 +235,7 @@ function isStringLiteral(node
|
|
|
235
235
|
function isExpression(node
|
|
236
236
|
/*: ESNode */
|
|
237
237
|
)
|
|
238
|
-
/*: node is Expression */
|
|
238
|
+
/*: implies node is Expression */
|
|
239
239
|
{
|
|
240
240
|
return node.type === 'ThisExpression' || node.type === 'ArrayExpression' || node.type === 'ObjectExpression' || // $FlowFixMe[incompatible-type]
|
|
241
241
|
node.type === 'ObjectExpression' || node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression' || node.type === 'YieldExpression' || node.type === 'Literal' || node.type === 'UnaryExpression' || node.type === 'UpdateExpression' || node.type === 'BinaryExpression' || node.type === 'AssignmentExpression' || node.type === 'LogicalExpression' || node.type === 'MemberExpression' || node.type === 'ConditionalExpression' || node.type === 'CallExpression' || node.type === 'NewExpression' || node.type === 'SequenceExpression' || node.type === 'TemplateLiteral' || node.type === 'TaggedTemplateExpression' || node.type === 'ClassExpression' || node.type === 'MetaProperty' || node.type === 'Identifier' || node.type === 'AwaitExpression' || node.type === 'ImportExpression' || node.type === 'ChainExpression' || node.type === 'TypeCastExpression' || node.type === 'AsExpression' || node.type === 'AsConstExpression' || node.type === 'JSXFragment' || node.type === 'JSXElement';
|
|
@@ -244,7 +244,7 @@ function isExpression(node
|
|
|
244
244
|
function isStatement(node
|
|
245
245
|
/*: ESNode */
|
|
246
246
|
)
|
|
247
|
-
/*: node is Statement */
|
|
247
|
+
/*: implies node is Statement */
|
|
248
248
|
{
|
|
249
249
|
return node.type === 'BlockStatement' || node.type === 'BreakStatement' || node.type === 'ClassDeclaration' || node.type === 'ContinueStatement' || node.type === 'DebuggerStatement' || node.type === 'DeclareClass' || node.type === 'DeclareVariable' || node.type === 'DeclareFunction' || node.type === 'DeclareInterface' || node.type === 'DeclareModule' || node.type === 'DeclareOpaqueType' || node.type === 'DeclareTypeAlias' || node.type === 'DoWhileStatement' || node.type === 'EmptyStatement' || node.type === 'EnumDeclaration' || node.type === 'ExpressionStatement' || node.type === 'ForInStatement' || node.type === 'ForOfStatement' || node.type === 'ForStatement' || node.type === 'FunctionDeclaration' || node.type === 'IfStatement' || node.type === 'InterfaceDeclaration' || node.type === 'LabeledStatement' || node.type === 'OpaqueType' || node.type === 'ReturnStatement' || node.type === 'SwitchStatement' || node.type === 'ThrowStatement' || node.type === 'TryStatement' || node.type === 'TypeAlias' || node.type === 'VariableDeclaration' || node.type === 'WhileStatement' || node.type === 'WithStatement';
|
|
250
250
|
}
|
package/dist/predicates.js.flow
CHANGED
|
@@ -47,31 +47,31 @@ import type {
|
|
|
47
47
|
|
|
48
48
|
export * from './generated/predicates';
|
|
49
49
|
|
|
50
|
-
export function isClass(node /*: ESNode */) /*: node is (ClassDeclaration | ClassExpression) */ {
|
|
50
|
+
export function isClass(node /*: ESNode */) /*: implies node is (ClassDeclaration | ClassExpression) */ {
|
|
51
51
|
return node.type === 'ClassDeclaration' || node.type === 'ClassExpression';
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export function isPropertyDefinitionWithNonComputedName(
|
|
55
55
|
node /*: ESNode */,
|
|
56
|
-
) /*: node is PropertyDefinitionWithNonComputedName */ {
|
|
56
|
+
) /*: implies node is PropertyDefinitionWithNonComputedName */ {
|
|
57
57
|
return node.type === 'PropertyDefinition' && node.computed === false;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export function isClassMember(node /*: ESNode */) /*: node is ClassMember */ {
|
|
60
|
+
export function isClassMember(node /*: ESNode */) /*: implies node is ClassMember */ {
|
|
61
61
|
return node.type === 'PropertyDefinition' || node.type === 'MethodDefinition';
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export function isClassMemberWithNonComputedName(
|
|
65
65
|
node /*: ESNode */,
|
|
66
|
-
) /*: node is (PropertyDefinitionWithNonComputedName | MethodDefinitionConstructor | MethodDefinitionWithNonComputedName) */ {
|
|
66
|
+
) /*: implies node is (PropertyDefinitionWithNonComputedName | MethodDefinitionConstructor | MethodDefinitionWithNonComputedName) */ {
|
|
67
67
|
return (node.type === 'PropertyDefinition' || node.type === 'MethodDefinition') && node.computed === false;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export function isComment(node /*: ESNode | Token */) /*: node is (MostTokens | BlockComment | LineComment) */ {
|
|
70
|
+
export function isComment(node /*: ESNode | Token */) /*: implies node is (MostTokens | BlockComment | LineComment) */ {
|
|
71
71
|
return node.type === 'Block' || node.type === 'Line';
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
export function isFunction(node /*: ESNode */) /*: node is AFunction */ {
|
|
74
|
+
export function isFunction(node /*: ESNode */) /*: implies node is AFunction */ {
|
|
75
75
|
return (
|
|
76
76
|
node.type === 'ArrowFunctionExpression' ||
|
|
77
77
|
node.type === 'FunctionDeclaration' ||
|
|
@@ -81,55 +81,55 @@ export function isFunction(node /*: ESNode */) /*: node is AFunction */ {
|
|
|
81
81
|
|
|
82
82
|
export function isMethodDefinitionWithNonComputedName(
|
|
83
83
|
node /*: ESNode */,
|
|
84
|
-
) /*: node is (MethodDefinitionConstructor | MethodDefinitionWithNonComputedName) */ {
|
|
84
|
+
) /*: implies node is (MethodDefinitionConstructor | MethodDefinitionWithNonComputedName) */ {
|
|
85
85
|
return node.type === 'MethodDefinition' && node.computed === false;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export function isMemberExpressionWithNonComputedProperty(
|
|
89
89
|
node /*: ESNode */,
|
|
90
|
-
) /*: node is MemberExpressionWithNonComputedName */ {
|
|
90
|
+
) /*: implies node is MemberExpressionWithNonComputedName */ {
|
|
91
91
|
return node.type === 'MemberExpression' && node.computed === false;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
export function isOptionalMemberExpressionWithNonComputedProperty(
|
|
95
95
|
node /*: ESNode */,
|
|
96
|
-
) /*: node is MemberExpressionWithNonComputedName */ {
|
|
96
|
+
) /*: implies node is MemberExpressionWithNonComputedName */ {
|
|
97
97
|
return node.type === 'MemberExpression' && node.computed === false;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
export function isObjectPropertyWithShorthand(node /*: ESNode */) /*: node is (ObjectPropertyWithShorthandStaticName | DestructuringObjectPropertyWithShorthandStaticName) */ {
|
|
100
|
+
export function isObjectPropertyWithShorthand(node /*: ESNode */) /*: implies node is (ObjectPropertyWithShorthandStaticName | DestructuringObjectPropertyWithShorthandStaticName) */ {
|
|
101
101
|
return node.type === 'Property' && node.shorthand === true;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export function isObjectPropertyWithNonComputedName(node /*: ESNode */) /*: node is (ObjectPropertyWithNonShorthandStaticName | ObjectPropertyWithShorthandStaticName | DestructuringObjectPropertyWithNonShorthandStaticName | DestructuringObjectPropertyWithShorthandStaticName) */ {
|
|
104
|
+
export function isObjectPropertyWithNonComputedName(node /*: ESNode */) /*: implies node is (ObjectPropertyWithNonShorthandStaticName | ObjectPropertyWithShorthandStaticName | DestructuringObjectPropertyWithNonShorthandStaticName | DestructuringObjectPropertyWithShorthandStaticName) */ {
|
|
105
105
|
return node.type === 'Property' && node.computed === false;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export function isBigIntLiteral(node /*: ESNode */) /*: node is BigIntLiteral */ {
|
|
108
|
+
export function isBigIntLiteral(node /*: ESNode */) /*: implies node is BigIntLiteral */ {
|
|
109
109
|
return node.type === 'Literal' && node.literalType === 'bigint';
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
export function isBooleanLiteral(node /*: ESNode */) /*: node is BooleanLiteral */ {
|
|
112
|
+
export function isBooleanLiteral(node /*: ESNode */) /*: implies node is BooleanLiteral */ {
|
|
113
113
|
return node.type === 'Literal' && node.literalType === 'boolean';
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export function isNullLiteral(node /*: ESNode */) /*: node is NullLiteral */ {
|
|
116
|
+
export function isNullLiteral(node /*: ESNode */) /*: implies node is NullLiteral */ {
|
|
117
117
|
return node.type === 'Literal' && node.literalType === 'null';
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
export function isNumericLiteral(node /*: ESNode */) /*: node is NumericLiteral */ {
|
|
120
|
+
export function isNumericLiteral(node /*: ESNode */) /*: implies node is NumericLiteral */ {
|
|
121
121
|
return node.type === 'Literal' && node.literalType === 'numeric';
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
export function isRegExpLiteral(node /*: ESNode */) /*: node is RegExpLiteral */ {
|
|
124
|
+
export function isRegExpLiteral(node /*: ESNode */) /*: implies node is RegExpLiteral */ {
|
|
125
125
|
return node.type === 'Literal' && node.literalType === 'regexp';
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
export function isStringLiteral(node /*: ESNode */) /*: node is StringLiteral */ {
|
|
128
|
+
export function isStringLiteral(node /*: ESNode */) /*: implies node is StringLiteral */ {
|
|
129
129
|
return node.type === 'Literal' && node.literalType === 'string';
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
export function isExpression(node /*: ESNode */) /*: node is Expression */ {
|
|
132
|
+
export function isExpression(node /*: ESNode */) /*: implies node is Expression */ {
|
|
133
133
|
return (
|
|
134
134
|
node.type === 'ThisExpression' ||
|
|
135
135
|
node.type === 'ArrayExpression' ||
|
|
@@ -166,7 +166,7 @@ export function isExpression(node /*: ESNode */) /*: node is Expression */ {
|
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
export function isStatement(node /*: ESNode */) /*: node is Statement */ {
|
|
169
|
+
export function isStatement(node /*: ESNode */) /*: implies node is Statement */ {
|
|
170
170
|
return (
|
|
171
171
|
node.type === 'BlockStatement' ||
|
|
172
172
|
node.type === 'BreakStatement' ||
|