MCPcopy Create free account
hub / github.com/microsoft/SandDance / checked

Function checked

docs/tests/v2/es6/js/sanddance.js:78684–78692  ·  view source on GitHub ↗
(length)

Source from the content-addressed store, hash-verified

78682}
78683
78684function checked (length) {
78685 // Note: cannot use `length < kMaxLength()` here because that fails when
78686 // length is NaN (which is otherwise coerced to zero.)
78687 if (length >= kMaxLength()) {
78688 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
78689 'size: 0x' + kMaxLength().toString(16) + ' bytes')
78690 }
78691 return length | 0
78692}
78693
78694function SlowBuffer (length) {
78695 if (+length != length) { // eslint-disable-line eqeqeq

Callers 3

allocUnsafeFunction · 0.70
fromArrayLikeFunction · 0.70
fromObjectFunction · 0.70

Calls 2

kMaxLengthFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected