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

21 lines
595 B
JavaScript
Raw Normal View History

2018-02-12 17:26:06 +00:00
"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;