![JAR search and dependency download from the Maven repository](/logo.png)
package.index.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of array-buffer-byte-length Show documentation
Show all versions of array-buffer-byte-length Show documentation
Get the byte length of an ArrayBuffer, even in engines without a `.byteLength` method.
The newest version!
'use strict';
var callBound = require('call-bind/callBound');
var $byteLength = callBound('ArrayBuffer.prototype.byteLength', true);
var isArrayBuffer = require('is-array-buffer');
/** @type {import('.')} */
module.exports = function byteLength(ab) {
if (!isArrayBuffer(ab)) {
return NaN;
}
return $byteLength ? $byteLength(ab) : ab.byteLength;
}; // in node < 0.11, byteLength is an own nonconfigurable property
© 2015 - 2025 Weber Informatics LLC | Privacy Policy