Skip to content

Commit 8da9e4d

Browse files
mscdexBridgeAR
authored andcommitted
buffer: correct indexOf() error message
PR-URL: #29217 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent a007fe9 commit 8da9e4d

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

lib/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
907907
}
908908

909909
throw new ERR_INVALID_ARG_TYPE(
910-
'value', ['string', 'Buffer', 'Uint8Array'], val
910+
'value', ['number', 'string', 'Buffer', 'Uint8Array'], val
911911
);
912912
}
913913

test/parallel/test-bootstrap-modules.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const expectedModules = new Set([
2222
'Internal Binding native_module',
2323
'Internal Binding options',
2424
'Internal Binding process_methods',
25+
'Internal Binding string_decoder',
2526
'Internal Binding task_queue',
2627
'Internal Binding timers',
2728
'Internal Binding trace_events',

test/parallel/test-buffer-includes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
282282
{
283283
code: 'ERR_INVALID_ARG_TYPE',
284284
type: TypeError,
285-
message: 'The "value" argument must be one of type string, ' +
285+
message: 'The "value" argument must be one of type number, string, ' +
286286
`Buffer, or Uint8Array. Received type ${typeof val}`
287287
}
288288
);

test/parallel/test-buffer-indexof.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ assert.strictEqual(Buffer.from('aaaaa').indexOf('b', 'ucs2'), -1);
357357
{
358358
code: 'ERR_INVALID_ARG_TYPE',
359359
type: TypeError,
360-
message: 'The "value" argument must be one of type string, ' +
360+
message: 'The "value" argument must be one of type number, string, ' +
361361
`Buffer, or Uint8Array. Received type ${typeof val}`
362362
}
363363
);

0 commit comments

Comments
 (0)