Frontend/25_01_07/mai/node_modules/array-buffer-byte-length/index.js
szabomarton 7f4a15b9c3 asd
2025-01-28 11:38:27 +01:00

15 lines
412 B
JavaScript

'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