Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!isMultipleOfTransactionLength(offset)) {
throw new RangeError(errors.ILLEGAL_TRANSACTION_OFFSET)
}
if (!Number.isInteger(length)) {
throw new TypeError(errors.ILLEGAL_BUNDLE_LENGTH)
}
if (!isMultipleOfTransactionLength(length)) {
throw new RangeError(errors.ILLEGAL_BUNDLE_LENGTH)
}
let sum = 0
for (let bundleOffset = 0; bundleOffset < length; bundleOffset += TRANSACTION_LENGTH) {
sum += tritsToValue(transactionValue(buffer, offset + bundleOffset))
}
return sum
}