bare-buffer
Advanced tools
Comparing version 2.7.0 to 2.7.1
10
index.js
@@ -150,4 +150,8 @@ const constants = require('./lib/constants') | ||
indexOf(value, offset = 0, encoding) { | ||
if (typeof value === 'number') return super.indexOf(value & 0xff, offset) | ||
if (typeof value === 'boolean') value = +value | ||
if (typeof value === 'number') { | ||
return super.indexOf(value & 0xff, offset) | ||
} | ||
return bidirectionalIndexOf(this, value, offset, encoding, true /* first */) | ||
@@ -157,2 +161,4 @@ } | ||
lastIndexOf(value, offset = this.byteLength - 1, encoding) { | ||
if (typeof value === 'boolean') value = +value | ||
if (typeof value === 'number') { | ||
@@ -209,3 +215,3 @@ return super.lastIndexOf(value & 0xff, offset) | ||
toString(encoding, start = 0, end = this.byteLength) { | ||
toString(encoding = 'utf8', start = 0, end = this.byteLength) { | ||
// toString() | ||
@@ -212,0 +218,0 @@ if (arguments.length === 0) return utf8.toString(this) |
{ | ||
"name": "bare-buffer", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "Native buffers for JavaScript", | ||
"exports": { | ||
".": "./index.js", | ||
".": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"./package": "./package.json", | ||
@@ -13,2 +16,3 @@ "./global": "./global.js", | ||
"index.js", | ||
"index.d.ts", | ||
"global.js", | ||
@@ -15,0 +19,0 @@ "binding.c", |
1213687
28
722