MCPcopy Index your code
hub / github.com/TruthHun/BookStack / alloc

Function alloc

static/word2md/mammoth.browser.js:9863–9877  ·  view source on GitHub ↗
(that, size, fill, encoding)

Source from the content-addressed store, hash-verified

9861}
9862
9863function 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.

Callers 1

mammoth.browser.jsFile · 0.70

Calls 2

assertSizeFunction · 0.70
createBufferFunction · 0.70

Tested by

no test coverage detected