MCPcopy Index your code
hub / github.com/UI5/webcomponents / alloc

Function alloc

packages/main/test/pages/diffable-html.js:284–298  ·  view source on GitHub ↗
(size, fill, encoding)

Source from the content-addressed store, hash-verified

282 }
283
284 function alloc (size, fill, encoding) {
285 assertSize(size)
286 if (size <= 0) {
287 return createBuffer(size)
288 }
289 if (fill !== undefined) {
290 // Only pay attention to encoding if it's a string. This
291 // prevents accidentally sending in a number that would
292 // be interpretted as a start offset.
293 return typeof encoding === 'string'
294 ? createBuffer(size).fill(fill, encoding)
295 : createBuffer(size).fill(fill)
296 }
297 return createBuffer(size)
298 }
299
300 /**
301 * Creates a new filled Buffer instance.

Callers 1

diffable-html.jsFile · 0.85

Calls 2

assertSizeFunction · 0.85
createBufferFunction · 0.85

Tested by

no test coverage detected