bare-buffer 2.2.0 → 2.3.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/index.js +5 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -381,7 +381,11 @@ exports.allocUnsafeSlow = function allocUnsafeSlow (size) {
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
exports.byteLength = function byteLength (string, encoding) {
|
|
384
|
-
|
|
384
|
+
if (typeof string === 'string') {
|
|
385
|
+
return codecFor(encoding).byteLength(string)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return string.byteLength
|
|
385
389
|
}
|
|
386
390
|
|
|
387
391
|
exports.compare = function compare (a, b) {
|