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