reign
Version:
A persistent, typed-objects implementation.
14 lines (12 loc) • 327 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.alignTo = alignTo;
/**
* Ensure that the given value is aligned to the given number of bytes.
*/
function alignTo(value, numberOfBytes) {
const rem = value % numberOfBytes;
return rem === 0 ? value : value + (numberOfBytes - rem);
}