Skip to content

Commit 358c45d

Browse files
committed
fix: replace includes call with indexOf check
1 parent b45ba6c commit 358c45d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/node_modules/@stdlib/_tools/scripts/transform.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ function transformer( fileInfo, api ) {
206206
// If the string literal is inside a NewExpression for an error, replace the string literal with the error message...
207207
else if (
208208
// Case: new Error( format( '...', ... ) )
209-
( path.parent.parent.value.type === 'NewExpression' &&
210-
ERROR_NAMES.includes( path.parent.parent.value.callee.name ) )
209+
path.parent.parent.value.type === 'NewExpression' &&
210+
ERROR_NAMES.indexOf( path.parent.parent.value.callee.name ) !== -1
211211
) {
212212
id = msg2id( path.value.value );
213213
if ( id ) {
@@ -219,8 +219,8 @@ function transformer( fileInfo, api ) {
219219
}
220220
else if (
221221
// Case: new Error( '...' )
222-
( path.parent.value.type === 'NewExpression' &&
223-
ERROR_NAMES.includes( path.parent.value.callee.name ) )
222+
path.parent.value.type === 'NewExpression' &&
223+
ERROR_NAMES.indexof( path.parent.value.callee.name ) !== -1
224224
) {
225225
id = msg2id( path.value.value );
226226
if ( id ) {

0 commit comments

Comments
 (0)