GT2/GT2-Android/node_modules/base64url/dist/pad-string.js

21 lines
595 B
JavaScript

"use strict";
function padString(input) {
var segmentLength = 4;
var stringLength = input.length;
var diff = stringLength % segmentLength;
if (!diff) {
return input;
}
var position = stringLength;
var padLength = segmentLength - diff;
var paddedStringLength = stringLength + padLength;
var buffer = new Buffer(paddedStringLength);
buffer.write(input);
while (padLength--) {
buffer.write("=", position++);
}
return buffer.toString();
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = padString;