MCPcopy Create free account
hub / github.com/bitpay/bitcore-message / checked

Function checked

bitcore-message.js:604–612  ·  view source on GitHub ↗
(length)

Source from the content-addressed store, hash-verified

602}
603
604function checked (length) {
605 // Note: cannot use `length < kMaxLength()` here because that fails when
606 // length is NaN (which is otherwise coerced to zero.)
607 if (length >= kMaxLength()) {
608 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
609 'size: 0x' + kMaxLength().toString(16) + ' bytes')
610 }
611 return length | 0
612}
613
614function SlowBuffer (length) {
615 if (+length != length) { // eslint-disable-line eqeqeq

Callers 3

allocUnsafeFunction · 0.85
fromArrayLikeFunction · 0.85
fromObjectFunction · 0.85

Calls 1

kMaxLengthFunction · 0.85

Tested by

no test coverage detected