MCPcopy Index your code
hub / github.com/SocketCluster/socketcluster / alloc

Function alloc

app/public/socketcluster-client.js:2806–2820  ·  view source on GitHub ↗
(size, fill, encoding)

Source from the content-addressed store, hash-verified

2804}
2805
2806function alloc (size, fill, encoding) {
2807 assertSize(size)
2808 if (size <= 0) {
2809 return createBuffer(size)
2810 }
2811 if (fill !== undefined) {
2812 // Only pay attention to encoding if it's a string. This
2813 // prevents accidentally sending in a number that would
2814 // be interpretted as a start offset.
2815 return typeof encoding === 'string'
2816 ? createBuffer(size).fill(fill, encoding)
2817 : createBuffer(size).fill(fill)
2818 }
2819 return createBuffer(size)
2820}
2821
2822/**
2823 * Creates a new filled Buffer instance.

Callers 1

Calls 2

assertSizeFunction · 0.85
createBufferFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…