mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-26 10:56:19 +08:00
* 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
46 lines
1.2 KiB
TypeScript
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_;
|
|
}
|