MCPcopy Index your code
hub / github.com/OneNoteDev/WebClipper / createBuffer

Function createBuffer

lib/sanitize-html.js:664–681  ·  view source on GitHub ↗
(that, length)

Source from the content-addressed store, hash-verified

662}
663
664function createBuffer (that, length) {
665 if (kMaxLength() < length) {
666 throw new RangeError('Invalid typed array length')
667 }
668 if (Buffer.TYPED_ARRAY_SUPPORT) {
669 // Return an augmented `Uint8Array` instance, for best performance
670 that = new Uint8Array(length)
671 that.__proto__ = Buffer.prototype
672 } else {
673 // Fallback: Return an object instance of the Buffer class
674 if (that === null) {
675 that = new Buffer(length)
676 }
677 that.length = length
678 }
679
680 return that
681}
682
683/**
684 * 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