* The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation wo
(arg, encodingOrOffset, length)
| 2705 | */ |
| 2706 | |
| 2707 | function Buffer (arg, encodingOrOffset, length) { |
| 2708 | // Common case. |
| 2709 | if (typeof arg === 'number') { |
| 2710 | if (typeof encodingOrOffset === 'string') { |
| 2711 | throw new TypeError( |
| 2712 | 'The "string" argument must be of type string. Received type number' |
| 2713 | ) |
| 2714 | } |
| 2715 | return allocUnsafe(arg) |
| 2716 | } |
| 2717 | return from(arg, encodingOrOffset, length) |
| 2718 | } |
| 2719 | |
| 2720 | // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 |
| 2721 | if (typeof Symbol !== 'undefined' && Symbol.species != null && |
nothing calls this directly
no test coverage detected
searching dependent graphs…