(that, size, fill, encoding)
| 9861 | } |
| 9862 | |
| 9863 | function alloc (that, size, fill, encoding) { |
| 9864 | assertSize(size) |
| 9865 | if (size <= 0) { |
| 9866 | return createBuffer(that, size) |
| 9867 | } |
| 9868 | if (fill !== undefined) { |
| 9869 | // Only pay attention to encoding if it's a string. This |
| 9870 | // prevents accidentally sending in a number that would |
| 9871 | // be interpretted as a start offset. |
| 9872 | return typeof encoding === 'string' |
| 9873 | ? createBuffer(that, size).fill(fill, encoding) |
| 9874 | : createBuffer(that, size).fill(fill) |
| 9875 | } |
| 9876 | return createBuffer(that, size) |
| 9877 | } |
| 9878 | |
| 9879 | /** |
| 9880 | * Creates a new filled Buffer instance. |
no test coverage detected