(that, size, fill, encoding)
| 45869 | } |
| 45870 | |
| 45871 | function alloc(that, size, fill, encoding) { |
| 45872 | assertSize(size); |
| 45873 | if (size <= 0) { |
| 45874 | return createBuffer(that, size); |
| 45875 | } |
| 45876 | if (fill !== undefined) { |
| 45877 | // Only pay attention to encoding if it's a string. This |
| 45878 | // prevents accidentally sending in a number that would |
| 45879 | // be interpretted as a start offset. |
| 45880 | return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill); |
| 45881 | } |
| 45882 | return createBuffer(that, size); |
| 45883 | } |
| 45884 | |
| 45885 | /** |
| 45886 | * Creates a new filled Buffer instance. |
no test coverage detected