Files
DefinitelyTyped/types/js-base64/index.d.ts
Thomas Lent 2b42a4123b Complete definition for js-base64 and update to version 2.3 (#20929)
* Update version number

* Format existing code

* Add name to authors

* Add tslint.json

* Rewrite to match module.d.ts template

* Add missing functions

* Add extendString and related String augmentation

* Correct uriSafe parameter to be optional

* Correct extended functions to be required

* Add new tests and fix global Base64

* Add missing uriSafe parameter to toBase64

* Enable strictNullChecks

* Add missing test case
2017-10-24 11:07:17 -07:00

46 lines
1.2 KiB
TypeScript

// Type definitions for js-base64 2.3
// Project: https://github.com/dankogai/js-base64
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>, Tommy Lent <https://github.com/tlent>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export namespace Base64 {
const VERSION: string;
function encode(s: string, uriSafe?: boolean): string;
function encodeURI(s: string): string;
function decode(base64: string): string;
function atob(base64: string): string;
function btoa(s: string): string;
function fromBase64(base64: string): string;
function toBase64(s: string, uriSafe?: boolean): string;
function btou(s: string): string;
function utob(s: string): string;
function noConflict(): typeof Base64;
function extendString(): void;
}
// Helper to allow referencing Base64 from inside the global declaration without creating a self reference
/* tslint:disable:strict-export-declare-modifiers */
type Base64_ = typeof Base64;
/* tslint:enable:strict-export-declare-modifiers */
declare global {
interface String {
fromBase64(): string;
toBase64(uriSafe?: boolean): string;
toBase64URI(): string;
}
const Base64: Base64_;
}