MCPcopy Create free account
hub / github.com/RubyLouvre/anu / createBuffer

Function createBuffer

test/babel.js:45771–45788  ·  view source on GitHub ↗
(that, length)

Source from the content-addressed store, hash-verified

45769 }
45770
45771 function createBuffer(that, length) {
45772 if (kMaxLength() < length) {
45773 throw new RangeError('Invalid typed array length');
45774 }
45775 if (Buffer.TYPED_ARRAY_SUPPORT) {
45776 // Return an augmented `Uint8Array` instance, for best performance
45777 that = new Uint8Array(length);
45778 that.__proto__ = Buffer.prototype;
45779 } else {
45780 // Fallback: Return an object instance of the Buffer class
45781 if (that === null) {
45782 that = new Buffer(length);
45783 }
45784 that.length = length;
45785 }
45786
45787 return that;
45788 }
45789
45790 /**
45791 * The Buffer constructor returns instances of `Uint8Array` that have their

Callers 5

allocFunction · 0.85
allocUnsafeFunction · 0.85
fromStringFunction · 0.85
fromArrayLikeFunction · 0.85
fromObjectFunction · 0.85

Calls 1

kMaxLengthFunction · 0.85

Tested by

no test coverage detected