main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
412 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
[79a0317] | 3 | var callBound = require('call-bound');
|
---|
[d565449] | 4 | var $byteLength = callBound('ArrayBuffer.prototype.byteLength', true);
|
---|
| 5 |
|
---|
| 6 | var isArrayBuffer = require('is-array-buffer');
|
---|
| 7 |
|
---|
| 8 | /** @type {import('.')} */
|
---|
| 9 | module.exports = function byteLength(ab) {
|
---|
| 10 | if (!isArrayBuffer(ab)) {
|
---|
| 11 | return NaN;
|
---|
| 12 | }
|
---|
| 13 | return $byteLength ? $byteLength(ab) : ab.byteLength;
|
---|
| 14 | }; // in node < 0.11, byteLength is an own nonconfigurable property
|
---|
Note:
See
TracBrowser
for help on using the repository browser.