MCPcopy Create free account
hub / github.com/RubyLouvre/anu / alloc

Function alloc

test/babel.js:45871–45883  ·  view source on GitHub ↗
(that, size, fill, encoding)

Source from the content-addressed store, hash-verified

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.

Callers 1

babel.jsFile · 0.85

Calls 2

assertSizeFunction · 0.85
createBufferFunction · 0.85

Tested by

no test coverage detected