UNPKG

@iota/pad

Version:

Padding utility

18 lines 687 B
"use strict"; exports.__esModule = true; var errors = require("../../errors"); require("../../typed-array"); exports.padTrytes = function (length) { return function (trytes) { return trytes.length < length ? trytes.concat('9'.repeat(length - trytes.length)) : trytes; }; }; exports.padTrits = function (length) { return function (trits) { if (trits.length > length) { throw new Error(errors.ILLEGAL_PADDING_LENGTH); } var tritsCopy = new Int8Array(length); tritsCopy.set(trits, 0); return tritsCopy; }; }; exports.padTag = exports.padTrytes(27); exports.padTagArray = function (tags) { return tags.map(exports.padTag); }; //# sourceMappingURL=index.js.map