main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
421 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var callBound = require('call-bind/callBound');
|
---|
| 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.