mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #58055 b2a: added base64url encode/decode function types (v1.1.0) by @Merlinio
* b2a: added base64url encode/decode function types * b2a: added base64url encode/decode function types (indent.fix)
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
import { btoa, atob } from "b2a";
|
||||
import { atob, atobu, btoa, btoau } from "b2a";
|
||||
|
||||
const b64 = btoa ("foo");
|
||||
const text = atob (b64);
|
||||
|
||||
// Conversion to Base64 and back
|
||||
const encoded = btoa('中文'); // $ExpectType string
|
||||
const decoded = atob('5Lit5paH'); // $ExpectType string
|
||||
|
||||
// Conversion to Base64url and back
|
||||
const encoded_url = btoau('μπορούμε'); // $ExpectType string
|
||||
const decoded_url = atobu('zrzPgM6_z4HOv8-NzrzOtQ=='); // $ExpectedType string
|
||||
|
||||
23
types/b2a/index.d.ts
vendored
23
types/b2a/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for b2a 1.0
|
||||
// Type definitions for b2a 1.1
|
||||
// Project: https://github.com/kaelzhang/b2a#readme
|
||||
// Definitions by: PatPL <https://github.com/PatPL>
|
||||
// Merlinio <https://github.com/Merlinio>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
@@ -8,12 +9,24 @@
|
||||
*/
|
||||
declare function atob(base64: string): string;
|
||||
|
||||
/**
|
||||
* Converts text into base64 string
|
||||
*/
|
||||
/**
|
||||
* Converts base64url string back into original text
|
||||
*/
|
||||
declare function atobu(base64: string): string;
|
||||
|
||||
/**
|
||||
* Converts text into base64 string
|
||||
*/
|
||||
declare function btoa(text: string): string;
|
||||
|
||||
/**
|
||||
* Converts text into base64url string
|
||||
*/
|
||||
declare function btoau(text: string): string;
|
||||
|
||||
export {
|
||||
atob,
|
||||
btoa
|
||||
atobu,
|
||||
btoa,
|
||||
btoau
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user