You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
421 B
15 lines
421 B
'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
|