@oozcitak/url 0.0.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +14 -0
  2. package/lib/URLAlgorithm.d.ts +267 -321
  3. package/lib/URLAlgorithm.js +2217 -2184
  4. package/lib/URLAlgorithm.js.map +1 -1
  5. package/lib/URLImpl.d.ts +22 -14
  6. package/lib/URLImpl.js +24 -25
  7. package/lib/URLImpl.js.map +1 -1
  8. package/lib/URLSearchParamsImpl.d.ts +0 -2
  9. package/lib/URLSearchParamsImpl.js +4 -5
  10. package/lib/URLSearchParamsImpl.js.map +1 -1
  11. package/lib/index.d.ts +2 -4
  12. package/lib/index.js +4 -15
  13. package/lib/index.js.map +1 -1
  14. package/package.json +5 -5
  15. package/lib/IDNAMappingTable.d.ts +0 -41
  16. package/lib/IDNAMappingTable.js +0 -8688
  17. package/lib/IDNAMappingTable.js.map +0 -1
  18. package/lib/TreeMap.d.ts +0 -39
  19. package/lib/TreeMap.js +0 -105
  20. package/lib/TreeMap.js.map +0 -1
  21. package/lib/algorithm/URLAlgorithm.d.ts +0 -321
  22. package/lib/algorithm/URLAlgorithm.js +0 -2552
  23. package/lib/algorithm/URLAlgorithm.js.map +0 -1
  24. package/lib/algorithm/index.d.ts +0 -1
  25. package/lib/algorithm/index.js +0 -5
  26. package/lib/algorithm/index.js.map +0 -1
  27. package/lib/interfacesInternal.d.ts +0 -22
  28. package/lib/interfacesInternal.js +0 -3
  29. package/lib/interfacesInternal.js.map +0 -1
  30. package/lib/url/URLImpl.d.ts +0 -45
  31. package/lib/url/URLImpl.js +0 -329
  32. package/lib/url/URLImpl.js.map +0 -1
  33. package/lib/url/URLSearchParamsImpl.d.ts +0 -40
  34. package/lib/url/URLSearchParamsImpl.js +0 -184
  35. package/lib/url/URLSearchParamsImpl.js.map +0 -1
  36. package/lib/url/index.d.ts +0 -4
  37. package/lib/url/index.js +0 -16
  38. package/lib/url/index.js.map +0 -1
  39. package/lib/url/interfaces.d.ts +0 -195
  40. package/lib/url/interfaces.js +0 -31
  41. package/lib/url/interfaces.js.map +0 -1
  42. package/lib/util/StringWalker.d.ts +0 -48
  43. package/lib/util/StringWalker.js +0 -92
  44. package/lib/util/StringWalker.js.map +0 -1
  45. package/lib/util/index.d.ts +0 -59
  46. package/lib/util/index.js +0 -170
  47. package/lib/util/index.js.map +0 -1
@@ -1,184 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const URLAlgorithm_1 = require("../algorithm/URLAlgorithm");
4
- const util_1 = require("../util");
5
- /**
6
- * Represents URL query parameters.
7
- */
8
- class URLSearchParamsImpl {
9
- /**
10
- * Initializes a new `URLSearchParams`.
11
- *
12
- * @param init - initial values of query parameters
13
- */
14
- constructor(init = "") {
15
- this._list = [];
16
- this._urlObject = null;
17
- this._algo = new URLAlgorithm_1.URLAlgorithm();
18
- /**
19
- * 1. Let query be a new URLSearchParams object.
20
- * 2. If init is a sequence, then for each pair in init:
21
- * 3. If pair does not contain exactly two items, then throw a TypeError.
22
- * 4. Append a new name-value pair whose name is pair’s first item, and
23
- * value is pair’s second item, to query’s list.
24
- * 5. Otherwise, if init is a record, then for each name → value in init,
25
- * append a new name-value pair whose name is name and value is value, to
26
- * query’s list.
27
- * 6. Otherwise, init is a string, then set query’s list to the result of
28
- * parsing init.
29
- * 7. Return query.
30
- */
31
- if (util_1.isArray(init)) {
32
- for (const item of init) {
33
- if (item.length !== 2) {
34
- throw new TypeError("Each item of init must be a two-tuple.");
35
- }
36
- this._list.push([item[0], item[1]]);
37
- }
38
- }
39
- else if (util_1.isObject(init)) {
40
- for (const name in init) {
41
- /* istanbul ignore else */
42
- if (init.hasOwnProperty(name)) {
43
- this._list.push([name, init[name]]);
44
- }
45
- }
46
- }
47
- else {
48
- this._list = this._algo.urlEncodedStringParser(init);
49
- }
50
- }
51
- /**
52
- * Runs the update steps.
53
- */
54
- _updateSteps() {
55
- /**
56
- * 1. Let query be the serialization of URLSearchParams object’s list.
57
- * 2. If query is the empty string, then set query to null.
58
- * 3. Set url object’s url’s query to query.
59
- */
60
- let query = this._algo.urlEncodedSerializer(this._list);
61
- if (query === "")
62
- query = null;
63
- if (this._urlObject !== null)
64
- this._urlObject._url.query = query;
65
- }
66
- /** @inheritdoc */
67
- append(name, value) {
68
- /**
69
- * 1. Append a new name-value pair whose name is name and value is value,
70
- * to list.
71
- * 2. Run the update steps.
72
- */
73
- this._list.push([name, value]);
74
- this._updateSteps();
75
- }
76
- /** @inheritdoc */
77
- delete(name) {
78
- /**
79
- * 1. Remove all name-value pairs whose name is name from list.
80
- * 2. Run the update steps.
81
- */
82
- for (let i = this._list.length - 1; i >= 0; i--) {
83
- if (this._list[i][0] === name)
84
- this._list.splice(i, 1);
85
- }
86
- this._updateSteps();
87
- }
88
- /** @inheritdoc */
89
- get(name) {
90
- /**
91
- * The get(name) method, when invoked, must return the value of the
92
- * first name-value pair whose name is name in list, if there is such
93
- * a pair, and null otherwise.
94
- */
95
- for (const item of this._list) {
96
- if (item[0] === name)
97
- return item[1];
98
- }
99
- return null;
100
- }
101
- /** @inheritdoc */
102
- getAll(name) {
103
- /**
104
- * The getAll(name) method, when invoked, must return the values of all
105
- * name-value pairs whose name is name, in list, in list order, and the
106
- * empty sequence otherwise.
107
- */
108
- const values = [];
109
- for (const item of this._list) {
110
- if (item[0] === name)
111
- values.push(item[1]);
112
- }
113
- return values;
114
- }
115
- /** @inheritdoc */
116
- has(name) {
117
- /**
118
- * The has(name) method, when invoked, must return true if there is
119
- * a name-value pair whose name is name in list, and false otherwise.
120
- */
121
- for (const item of this._list) {
122
- if (item[0] === name)
123
- return true;
124
- }
125
- return false;
126
- }
127
- /** @inheritdoc */
128
- set(name, value) {
129
- /**
130
- * 1. If there are any name-value pairs whose name is name, in list,
131
- * set the value of the first such name-value pair to value and remove
132
- * the others.
133
- * 2. Otherwise, append a new name-value pair whose name is name and value
134
- * is value, to list.
135
- * 3. Run the update steps.
136
- */
137
- const toRemove = [];
138
- let found = false;
139
- for (let i = 0; i < this._list.length; i++) {
140
- if (this._list[i][0] === name) {
141
- if (!found) {
142
- found = true;
143
- this._list[i][1] = value;
144
- }
145
- else {
146
- toRemove.push(i);
147
- }
148
- }
149
- }
150
- if (!found) {
151
- this._list.push([name, value]);
152
- }
153
- for (const i of toRemove) {
154
- this._list.splice(i, 1);
155
- }
156
- }
157
- /** @inheritdoc */
158
- sort() {
159
- /**
160
- * 1. Sort all name-value pairs, if any, by their names. Sorting must be
161
- * done by comparison of code units. The relative order between name-value
162
- * pairs with equal names must be preserved.
163
- * 2. Run the update steps.
164
- */
165
- this._list.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));
166
- this._updateSteps();
167
- }
168
- /** @inheritdoc */
169
- *[Symbol.iterator]() {
170
- /**
171
- * The value pairs to iterate over are the list name-value pairs with the
172
- * key being the name and the value being the value.
173
- */
174
- for (const item of this._list) {
175
- yield item;
176
- }
177
- }
178
- /** @inheritdoc */
179
- toString() {
180
- return this._algo.urlEncodedSerializer(this._list);
181
- }
182
- }
183
- exports.URLSearchParamsImpl = URLSearchParamsImpl;
184
- //# sourceMappingURL=URLSearchParamsImpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"URLSearchParamsImpl.js","sourceRoot":"","sources":["../../src/url/URLSearchParamsImpl.ts"],"names":[],"mappings":";;AACA,4DAAwD;AACxD,kCAA2C;AAE3C;;GAEG;AACH,MAAa,mBAAmB;IAO9B;;;;OAIG;IACH,YAAY,OAAwD,EAAE;QAVtE,UAAK,GAAuB,EAAE,CAAA;QAC9B,eAAU,GAAe,IAAI,CAAA;QAU3B,IAAI,CAAC,KAAK,GAAG,IAAI,2BAAY,EAAE,CAAA;QAE/B;;;;;;;;;;;;WAYG;QACH,IAAI,cAAO,CAAC,IAAI,CAAC,EAAE;YACjB,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;gBACvB,IAAI,IAAI,CAAC,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AAI,CAAC,KAAK,CAAC,CAAA;IACpD,CAAC;CAEF;AArLD,kDAqLC"}
@@ -1,4 +0,0 @@
1
- import * as Interfaces from './interfaces';
2
- export { Interfaces };
3
- export { URLImpl as URL } from './URLImpl';
4
- export { URLSearchParamsImpl as URLSearchParams } from './URLSearchParamsImpl';
package/lib/url/index.js DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __importStar = (this && this.__importStar) || function (mod) {
3
- if (mod && mod.__esModule) return mod;
4
- var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
7
- return result;
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const Interfaces = __importStar(require("./interfaces"));
11
- exports.Interfaces = Interfaces;
12
- var URLImpl_1 = require("./URLImpl");
13
- exports.URL = URLImpl_1.URLImpl;
14
- var URLSearchParamsImpl_1 = require("./URLSearchParamsImpl");
15
- exports.URLSearchParams = URLSearchParamsImpl_1.URLSearchParamsImpl;
16
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yDAA0C;AACjC,gCAAU;AAEnB,qCAA0C;AAAjC,wBAAA,OAAO,CAAO;AACvB,6DAA8E;AAArE,gDAAA,mBAAmB,CAAmB"}
@@ -1,195 +0,0 @@
1
- /**
2
- * Represents an URL.
3
- */
4
- export interface URL {
5
- /**
6
- * Gets the serialization of url.
7
- */
8
- readonly href: string;
9
- /**
10
- * Gets the serialization of url's origin.
11
- */
12
- readonly origin: string;
13
- /**
14
- * Gets or sets the url's scheme, followed by `":"`.
15
- */
16
- protocol: string;
17
- /**
18
- * Gets or sets the url's username.
19
- */
20
- username: string;
21
- /**
22
- * Gets or sets the url's password.
23
- */
24
- password: string;
25
- /**
26
- * Gets or sets the url's host.
27
- */
28
- host: string;
29
- /**
30
- * Gets or sets the url's hostname.
31
- */
32
- hostname: string;
33
- /**
34
- * Gets or sets the url's port.
35
- */
36
- port: string;
37
- /**
38
- * Gets or sets the url's path name.
39
- */
40
- pathname: string;
41
- /**
42
- * Gets or sets the url's query string.
43
- */
44
- search: string;
45
- /**
46
- * Gets the url's query parameters.
47
- */
48
- readonly searchParams: URLSearchParams;
49
- /**
50
- * Gets or sets the url's hash.
51
- */
52
- hash: string;
53
- /**
54
- * Returns the serialization of url.
55
- */
56
- toJSON(): string;
57
- _url: URLRecord;
58
- _queryObject: URLSearchParams;
59
- }
60
- /**
61
- * Represents an URL record.
62
- */
63
- export interface URLRecord {
64
- /**
65
- * The type of URL
66
- */
67
- scheme: string;
68
- /**
69
- * Username
70
- */
71
- username: string;
72
- /**
73
- * Password
74
- */
75
- password: string;
76
- /**
77
- * Host
78
- */
79
- host: Host | null;
80
- /**
81
- * Port
82
- */
83
- port: number | null;
84
- /**
85
- * Path
86
- */
87
- path: string[];
88
- /**
89
- * Query string
90
- */
91
- query: string | null;
92
- /**
93
- * Fragment
94
- */
95
- fragment: string | null;
96
- _cannotBeABaseURLFlag: boolean;
97
- _blobURLEntry: any | null;
98
- }
99
- /**
100
- * Represents URL query parameters.
101
- */
102
- export interface URLSearchParams extends Iterable<[string, string]> {
103
- /**
104
- * Appends a new name/value pair to the query parameters.
105
- *
106
- * @param name - query string name
107
- * @param value - query string value
108
- */
109
- append(name: string, value: string): void;
110
- /**
111
- * Removes all query parameters with the given name.
112
- *
113
- * @param name - query string name
114
- */
115
- delete(name: string): void;
116
- /**
117
- * Gets the value of the first query parameter with the given name.
118
- *
119
- * @param name - query string name
120
- */
121
- get(name: string): string | null;
122
- /**
123
- * Gets the values of all query parameters with the given name.
124
- *
125
- * @param name - query string name
126
- */
127
- getAll(name: string): string[];
128
- /**
129
- * Determines whether a query parameter with the given name exists.
130
- *
131
- * @param name - query string name
132
- */
133
- has(name: string): boolean;
134
- /**
135
- * Replaces all query parameter with the given name with the given value.
136
- *
137
- * @param name - query string name
138
- * @param value - query string value
139
- */
140
- set(name: string, value: string): void;
141
- /**
142
- * Sorts all query parameters with their name.
143
- */
144
- sort(): void;
145
- /**
146
- * Converts query parameters to a string.
147
- */
148
- toString(): string;
149
- _list: [string, string][];
150
- _urlObject: URL | null;
151
- }
152
- /**
153
- * Represents the state of the URL parser.
154
- */
155
- export declare enum ParserState {
156
- SchemeStart = 0,
157
- Scheme = 1,
158
- NoScheme = 2,
159
- SpecialRelativeOrAuthority = 3,
160
- PathOrAuthority = 4,
161
- Relative = 5,
162
- RelativeSlash = 6,
163
- SpecialAuthoritySlashes = 7,
164
- SpecialAuthorityIgnoreSlashes = 8,
165
- Authority = 9,
166
- Host = 10,
167
- Hostname = 11,
168
- Port = 12,
169
- File = 13,
170
- FileSlash = 14,
171
- FileHost = 15,
172
- PathStart = 16,
173
- Path = 17,
174
- CannotBeABaseURLPath = 18,
175
- Query = 19,
176
- Fragment = 20
177
- }
178
- /**
179
- * Represents an URL's host as either of:
180
- * - a domain as a string
181
- * - an IPv4 address as a number
182
- * - an IPv6 address as a list of eight numbers
183
- * - an opaque host as a string
184
- * - or an empty host the an empty string `""`
185
- */
186
- export declare type Host = string | number | number[];
187
- /**
188
- * Represents an origin as a tuple of:
189
- * - A scheme (a scheme).
190
- * - A host (a host).
191
- * - A port (a port).
192
- * - A domain (null or a domain). Null unless stated otherwise.
193
- */
194
- export declare type Origin = [string, Host, number | null, string | null];
195
- export declare const OpaqueOrigin: Origin;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Represents the state of the URL parser.
5
- */
6
- var ParserState;
7
- (function (ParserState) {
8
- ParserState[ParserState["SchemeStart"] = 0] = "SchemeStart";
9
- ParserState[ParserState["Scheme"] = 1] = "Scheme";
10
- ParserState[ParserState["NoScheme"] = 2] = "NoScheme";
11
- ParserState[ParserState["SpecialRelativeOrAuthority"] = 3] = "SpecialRelativeOrAuthority";
12
- ParserState[ParserState["PathOrAuthority"] = 4] = "PathOrAuthority";
13
- ParserState[ParserState["Relative"] = 5] = "Relative";
14
- ParserState[ParserState["RelativeSlash"] = 6] = "RelativeSlash";
15
- ParserState[ParserState["SpecialAuthoritySlashes"] = 7] = "SpecialAuthoritySlashes";
16
- ParserState[ParserState["SpecialAuthorityIgnoreSlashes"] = 8] = "SpecialAuthorityIgnoreSlashes";
17
- ParserState[ParserState["Authority"] = 9] = "Authority";
18
- ParserState[ParserState["Host"] = 10] = "Host";
19
- ParserState[ParserState["Hostname"] = 11] = "Hostname";
20
- ParserState[ParserState["Port"] = 12] = "Port";
21
- ParserState[ParserState["File"] = 13] = "File";
22
- ParserState[ParserState["FileSlash"] = 14] = "FileSlash";
23
- ParserState[ParserState["FileHost"] = 15] = "FileHost";
24
- ParserState[ParserState["PathStart"] = 16] = "PathStart";
25
- ParserState[ParserState["Path"] = 17] = "Path";
26
- ParserState[ParserState["CannotBeABaseURLPath"] = 18] = "CannotBeABaseURLPath";
27
- ParserState[ParserState["Query"] = 19] = "Query";
28
- ParserState[ParserState["Fragment"] = 20] = "Fragment";
29
- })(ParserState = exports.ParserState || (exports.ParserState = {}));
30
- exports.OpaqueOrigin = ["", "", null, null];
31
- //# sourceMappingURL=interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/url/interfaces.ts"],"names":[],"mappings":";;AA6JA;;GAEG;AACH,IAAY,WAsBX;AAtBD,WAAY,WAAW;IACrB,2DAAW,CAAA;IACX,iDAAM,CAAA;IACN,qDAAQ,CAAA;IACR,yFAA0B,CAAA;IAC1B,mEAAe,CAAA;IACf,qDAAQ,CAAA;IACR,+DAAa,CAAA;IACb,mFAAuB,CAAA;IACvB,+FAA6B,CAAA;IAC7B,uDAAS,CAAA;IACT,8CAAI,CAAA;IACJ,sDAAQ,CAAA;IACR,8CAAI,CAAA;IACJ,8CAAI,CAAA;IACJ,wDAAS,CAAA;IACT,sDAAQ,CAAA;IACR,wDAAS,CAAA;IACT,8CAAI,CAAA;IACJ,8EAAoB,CAAA;IACpB,gDAAK,CAAA;IACL,sDAAQ,CAAA;AACV,CAAC,EAtBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAsBtB;AAoBY,QAAA,YAAY,GAAW,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
@@ -1,48 +0,0 @@
1
- /**
2
- * Walks through the code points of a string.
3
- */
4
- export declare class StringWalker {
5
- private _chars;
6
- private _length;
7
- private _pointer;
8
- private _codePoint;
9
- private _c;
10
- private _remaining;
11
- private _substring;
12
- /**
13
- * Initializes a new `StringWalker`.
14
- *
15
- * @param input - input string
16
- */
17
- constructor(input: string);
18
- /**
19
- * Determines if the current position is beyond the end of string.
20
- */
21
- readonly eof: boolean;
22
- /**
23
- * Returns the number of code points in the input string.
24
- */
25
- readonly length: number;
26
- /**
27
- * Returns the current code point. Returns `-1` if the position is beyond
28
- * the end of string.
29
- */
30
- codePoint(): number;
31
- /**
32
- * Returns the current character. Returns an empty string if the position is
33
- * beyond the end of string.
34
- */
35
- c(): string;
36
- /**
37
- * Returns the remaining string.
38
- */
39
- remaining(): string;
40
- /**
41
- * Returns the substring from the current character to the end of string.
42
- */
43
- substring(): string;
44
- /**
45
- * Gets or sets the current position.
46
- */
47
- pointer: number;
48
- }
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Walks through the code points of a string.
5
- */
6
- class StringWalker {
7
- /**
8
- * Initializes a new `StringWalker`.
9
- *
10
- * @param input - input string
11
- */
12
- constructor(input) {
13
- this._pointer = 0;
14
- this._chars = Array.from(input);
15
- this._length = this._chars.length;
16
- }
17
- /**
18
- * Determines if the current position is beyond the end of string.
19
- */
20
- get eof() { return this._pointer >= this._length; }
21
- /**
22
- * Returns the number of code points in the input string.
23
- */
24
- get length() { return this._length; }
25
- /**
26
- * Returns the current code point. Returns `-1` if the position is beyond
27
- * the end of string.
28
- */
29
- codePoint() {
30
- if (this._codePoint === undefined) {
31
- if (this.eof) {
32
- this._codePoint = -1;
33
- }
34
- else {
35
- const cp = this._chars[this._pointer].codePointAt(0);
36
- /* istanbul ignore else */
37
- if (cp !== undefined) {
38
- this._codePoint = cp;
39
- }
40
- else {
41
- this._codePoint = -1;
42
- }
43
- }
44
- }
45
- return this._codePoint;
46
- }
47
- /**
48
- * Returns the current character. Returns an empty string if the position is
49
- * beyond the end of string.
50
- */
51
- c() {
52
- if (this._c === undefined) {
53
- this._c = (this.eof ? "" : this._chars[this._pointer]);
54
- }
55
- return this._c;
56
- }
57
- /**
58
- * Returns the remaining string.
59
- */
60
- remaining() {
61
- if (this._remaining === undefined) {
62
- this._remaining = (this.eof ?
63
- "" : this._chars.slice(this._pointer + 1).join(''));
64
- }
65
- return this._remaining;
66
- }
67
- /**
68
- * Returns the substring from the current character to the end of string.
69
- */
70
- substring() {
71
- if (this._substring === undefined) {
72
- this._substring = (this.eof ?
73
- "" : this._chars.slice(this._pointer).join(''));
74
- }
75
- return this._substring;
76
- }
77
- /**
78
- * Gets or sets the current position.
79
- */
80
- get pointer() { return this._pointer; }
81
- set pointer(val) {
82
- if (val === this._pointer)
83
- return;
84
- this._pointer = val;
85
- this._codePoint = undefined;
86
- this._c = undefined;
87
- this._remaining = undefined;
88
- this._substring = undefined;
89
- }
90
- }
91
- exports.StringWalker = StringWalker;
92
- //# sourceMappingURL=StringWalker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StringWalker.js","sourceRoot":"","sources":["../../src/util/StringWalker.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAa,YAAY;IAUvB;;;;OAIG;IACH,YAAY,KAAa;QAXjB,aAAQ,GAAW,CAAC,CAAA;QAY1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IACnC,C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,EAAE,CAAC,CAAC,CAAA;SACtD;QACD,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE;YACjC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC3B,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;SAClD;QACD,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO,KAAc,OAAO,IAAI,CAAC,QAAQ,CAAA,CAAC,CAAC;IAC/C,IAAI,OAAO,CAAC,GAAW;QACrB,IAAI,GAAG,KAAK,IAAI,CAAC,QAAQ;YAAE,OAAM;QAEjC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAA;QAEnB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,IAAI,CAAC,EAAE,GAAG,SAAS,CAAA;QACnB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;CACF;AAlGD,oCAkGC"}
@@ -1,59 +0,0 @@
1
- /**
2
- * Type guard for boolean types
3
- *
4
- * @param x - a variable to type check
5
- */
6
- export declare function isBoolean(x: any): x is boolean;
7
- /**
8
- * Type guard for numeric types
9
- *
10
- * @param x - a variable to type check
11
- */
12
- export declare function isNumber(x: any): x is number;
13
- /**
14
- * Type guard for strings
15
- *
16
- * @param x - a variable to type check
17
- */
18
- export declare function isString(x: any): x is string;
19
- /**
20
- * Type guard for function objects
21
- *
22
- * @param x - a variable to type check
23
- */
24
- export declare function isFunction(x: any): x is Function;
25
- /**
26
- * Type guard for JS objects
27
- *
28
- * _Note:_ Functions are objects too
29
- *
30
- * @param x - a variable to type check
31
- */
32
- export declare function isObject(x: any): x is {
33
- [key: string]: any;
34
- };
35
- /**
36
- * Type guard for arrays
37
- *
38
- * @param x - a variable to type check
39
- */
40
- export declare function isArray(x: any): x is any[];
41
- /**
42
- * Determines if `x` is an empty Array or an Object with no own properties.
43
- *
44
- * @param x - a variable to check
45
- */
46
- export declare function isEmpty(x: any): boolean;
47
- /**
48
- * UTF-8 encodes the given string.
49
- *
50
- * @param input - a string
51
- */
52
- export declare function utf8Encode(input: string): Uint8Array;
53
- /**
54
- * UTF-8 decodes the given byte sequence into a string.
55
- *
56
- * @param bytes - a byte sequence
57
- */
58
- export declare function utf8Decode(bytes: Uint8Array): string;
59
- export { StringWalker } from './StringWalker';