UNPKG

appium-flutter-finder

Version:
32 lines 989 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.decode = exports.encode = void 0; var W3C_ELEMENT = "element-6066-11e4-a52e-4f735466cecf"; var encode = function (input) { return Buffer.from(input) .toString("base64") .replace(/=/g, "") .replace(/\+/g, "-") .replace(/\//g, "_"); }; exports.encode = encode; var decode = function (input) { var base64String = ""; if (typeof input === "string") { base64String = input; // @ts-ignore } else if (typeof input === "object" && input[W3C_ELEMENT]) { // @ts-ignore base64String = input[W3C_ELEMENT]; } else if (typeof input === "object" && input.ELEMENT) { base64String = input.ELEMENT; } else { throw new Error("input is invalid ".concat(JSON.stringify(input))); } return Buffer.from(base64String, "base64").toString(); }; exports.decode = decode; //# sourceMappingURL=base64url.js.map