• File: index.js
  • Full Path: /var/www/sandbox/node_modules/array-buffer-byte-length/index.js
  • Date Modified: 02/20/2025 6:17 PM
  • File size: 412 bytes
  • MIME-type: text/plain
  • Charset: utf-8
'use strict';

var callBound = require('call-bound');
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