|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
412 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var callBound = require('call-bound');
|
|---|
| 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.