Skip to content

Commit 50acfb8

Browse files
committed
fixup! buffer: improve performance of buffer indexof method
1 parent a628ad8 commit 50acfb8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
765765
dir = !!dir; // Cast to bool.
766766

767767
if (typeof val === 'string') {
768-
if (encoding === undefined) {
768+
if (encoding === undefined || encoding === 'utf8') {
769769
return indexOfString(buffer, val, byteOffset, encoding, dir);
770770
}
771771
return slowIndexOf(buffer, val, byteOffset, encoding, dir);

0 commit comments

Comments
 (0)