MCPcopy
hub / github.com/feross/buffer / checked

Function checked

index.js:322–330  ·  view source on GitHub ↗
(length)

Source from the content-addressed store, hash-verified

320}
321
322function checked (length) {
323 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
324 // length is NaN (which is otherwise coerced to zero.)
325 if (length >= K_MAX_LENGTH) {
326 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
327 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
328 }
329 return length | 0
330}
331
332function SlowBuffer (length) {
333 if (+length != length) { // eslint-disable-line eqeqeq

Callers 3

allocUnsafeFunction · 0.85
fromArrayLikeFunction · 0.85
fromObjectFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…