(size, fill, encoding)
| 184 | } |
| 185 | } |
| 186 | function alloc(size, fill, encoding) { |
| 187 | assertSize(size); |
| 188 | if (size <= 0) { |
| 189 | return createBuffer(size); |
| 190 | } |
| 191 | if (fill !== undefined) { |
| 192 | // Only pay attention to encoding if it's a string. This |
| 193 | // prevents accidentally sending in a number that would |
| 194 | // be interpreted as a start offset. |
| 195 | return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); |
| 196 | } |
| 197 | return createBuffer(size); |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Creates a new filled Buffer instance. |
no test coverage detected
searching dependent graphs…