brianloveswords/base64url

Compatibility issue on IE 11 due to default parameters

Closed this issue · 1 comments

Since this package is targeting to es6, default parameters will be omitted by ts compiler. However IE 11 doesn't support default parameters.

function decode(base64url: string, encoding: string = "utf8"): string {
    return Buffer.from(toBase64(base64url), "base64").toString(encoding);
}

function encode(input: string | Buffer, encoding: string = "utf8"): string {
    if (Buffer.isBuffer(input)) {
        return fromBase64(input.toString("base64"));
    }
    return fromBase64(Buffer.from(input as string, encoding).toString("base64"));
};

Suggested solution:
change tsconfig.json to target to 'es5' or
avoid using default parameters

blockstack is affect by this issue: hirosystems/stacks.js#541