(size, fill, encoding)
| 112969 | else if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); |
| 112970 | } |
| 112971 | function alloc(size, fill, encoding) { |
| 112972 | assertSize(size); |
| 112973 | if (size <= 0) return createBuffer(size); |
| 112974 | if (fill !== undefined) // Only pay attention to encoding if it's a string. This |
| 112975 | // prevents accidentally sending in a number that would |
| 112976 | // be interpreted as a start offset. |
| 112977 | return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); |
| 112978 | return createBuffer(size); |
| 112979 | } |
| 112980 | /** |
| 112981 | * Creates a new filled Buffer instance. |
| 112982 | * alloc(size[, fill[, encoding]]) |
no test coverage detected