You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
579 B

"use strict";
const { percentDecode } = require("whatwg-url");
const { atob } = require("abab");
exports.stripLeadingAndTrailingASCIIWhitespace = string => {
return string.replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, "");
};
exports.stringPercentDecode = input => {
return percentDecode(Buffer.from(input, "utf-8"));
};
exports.isomorphicDecode = input => {
return input.toString("binary");
};
exports.forgivingBase64Decode = data => {
const asString = atob(data);
if (asString === null) {
return null;
}
return Buffer.from(asString, "binary");
};