(that, size, fill, encoding)
| 78541 | } |
| 78542 | |
| 78543 | function alloc (that, size, fill, encoding) { |
| 78544 | assertSize(size) |
| 78545 | if (size <= 0) { |
| 78546 | return createBuffer(that, size) |
| 78547 | } |
| 78548 | if (fill !== undefined) { |
| 78549 | // Only pay attention to encoding if it's a string. This |
| 78550 | // prevents accidentally sending in a number that would |
| 78551 | // be interpretted as a start offset. |
| 78552 | return typeof encoding === 'string' |
| 78553 | ? createBuffer(that, size).fill(fill, encoding) |
| 78554 | : createBuffer(that, size).fill(fill) |
| 78555 | } |
| 78556 | return createBuffer(that, size) |
| 78557 | } |
| 78558 | |
| 78559 | /** |
| 78560 | * Creates a new filled Buffer instance. |
no test coverage detected