forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lz-string.d.ts
61 lines (54 loc) · 2.23 KB
/
lz-string.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Type definitions for lz-string v1.3.3
// Project: https://github.com/pieroxy/lz-string
// Definitions by: Roman Nikitin <https://github.com/M0ns1gn0r>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var LZString: LZString.LZStringStatic;
declare module LZString {
/**
* LZ-based compression algorithm for JavaScript.
*/
interface LZStringStatic {
/**
* Compresses input string producing an instance of an "invalid" UTF-16 string.
* Such string could be stored in localStorage only on webkit
* browsers (tested on Android, Chrome, Safari).
*
* @param uncompressed A string which should be compressed.
*/
compress(uncompressed: string): string;
/**
* Decompresses "invalid" input string created by the method compress().
*
* @param compressed A string obtained from a call to compress().
*/
decompress(compressed: string): string;
/**
* Compresses input string producing an instance of a "valid" UTF-16 string,
* in the sense that all browsers can store them safely.
*
* @param uncompressed A string which should be compressed.
*/
compressToUTF16(uncompressed: string): string;
/**
* Decompresses "valid" input string created by the method compressToUTF16().
*
* @param compressed A string obtained from a call to compressToUTF16().
*/
decompressFromUTF16(compressed: string): string;
/**
* Compresses input string producing an instance of a ASCII UTF-16 string,
* which represents the original string encoded in Base64.
* The result can be safely transported outside the browser with a
* guarantee that none of the characters produced need to be URL-encoded.
*
* @param uncompressed A string which should be compressed.
*/
compressToBase64(uncompressed: string): string;
/**
* Decompresses ASCII UTF-16 input string created by the method compressToBase64().
*
* @param compressed A string obtained from a call to compressToBase64().
*/
decompressFromBase64(compressed: string): string;
}
}