@tslite/parser 1.9.0 → 1.12.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.
- package/LICENSE +55 -0
- package/NOTICE +14 -0
- package/dist/_namespaces/ts.d.ts +18 -0
- package/dist/_namespaces/ts.js +21 -0
- package/dist/_namespaces/ts.performance.d.ts +1 -0
- package/dist/_namespaces/ts.performance.js +2 -0
- package/dist/core.d.ts +450 -0
- package/dist/core.js +1394 -0
- package/dist/corePublic.d.ts +62 -0
- package/dist/corePublic.js +31 -0
- package/dist/debug.d.ts +74 -0
- package/dist/debug.js +326 -0
- package/dist/diagnosticInformationMap.generated.d.ts +1435 -0
- package/dist/diagnosticInformationMap.generated.js +1441 -0
- package/dist/factory.d.ts +78 -0
- package/dist/factory.js +622 -0
- package/dist/factoryPublic.d.ts +314 -0
- package/dist/factoryPublic.js +1796 -0
- package/dist/index.d.ts +1 -249
- package/dist/index.js +4 -6
- package/dist/parser.d.ts +59 -0
- package/dist/parser.js +5075 -0
- package/dist/path.d.ts +312 -0
- package/dist/path.js +475 -0
- package/dist/perfLogger.d.ts +4 -0
- package/dist/perfLogger.js +38 -0
- package/dist/performance.d.ts +20 -0
- package/dist/performance.js +49 -0
- package/dist/performanceTimestamp.d.ts +2 -0
- package/dist/performanceTimestamp.js +2 -0
- package/dist/scanner.d.ts +80 -0
- package/dist/scanner.js +1984 -0
- package/dist/shims/mapShim.d.ts +23 -0
- package/dist/shims/mapShim.js +156 -0
- package/dist/types.d.ts +2626 -0
- package/dist/types.js +1074 -0
- package/dist/utilities.d.ts +473 -0
- package/dist/utilities.js +2632 -0
- package/dist/utilitiesPublic.d.ts +274 -0
- package/dist/utilitiesPublic.js +1049 -0
- package/dist/visitor.d.ts +15 -0
- package/dist/visitor.js +64 -0
- package/dist/visitorPublic.d.ts +82 -0
- package/dist/visitorPublic.js +352 -0
- package/package.json +14 -42
- package/dist/index.cjs +0 -6
- package/dist/index.d.cts +0 -249
package/LICENSE
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
+
|
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
+
|
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
20
|
+
|
|
21
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
22
|
+
|
|
23
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
24
|
+
|
|
25
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
26
|
+
|
|
27
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
28
|
+
|
|
29
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
30
|
+
|
|
31
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
34
|
+
|
|
35
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
36
|
+
|
|
37
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
38
|
+
|
|
39
|
+
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
40
|
+
|
|
41
|
+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
42
|
+
|
|
43
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
package/NOTICE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
TypeScript 3.9.10 — a parse tree do compilador (src/compiler e src/shims), copiada da tag v3.9.10
|
|
2
|
+
(commit b7de5e3c4cd) de https://github.com/microsoft/TypeScript.
|
|
3
|
+
|
|
4
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
6
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
7
|
+
License at http://www.apache.org/licenses/LICENSE-2.0 (o texto está em LICENSE).
|
|
8
|
+
|
|
9
|
+
Todos os arquivos de src/ foram modificados: o namespace `ts` do outFile virou
|
|
10
|
+
módulo ES, com os imports explícitos, por um codemod (packages/codemod deste
|
|
11
|
+
repositório). Cada arquivo diz de qual arquivo da tag veio, na primeira linha.
|
|
12
|
+
As mudanças seguintes a essa conversão (os cortes do recorte da Linguagem, do legado,
|
|
13
|
+
da configuração fixa, do host e do emit) estão registradas no §6 do
|
|
14
|
+
docs/ARCHITECTURE.md do pacote do checker (packages/checker).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from "../shims/mapShim.js";
|
|
2
|
+
export * from "../corePublic.js";
|
|
3
|
+
export * from "../core.js";
|
|
4
|
+
export * from "../debug.js";
|
|
5
|
+
export * from "../performanceTimestamp.js";
|
|
6
|
+
export * as performance from "./ts.performance.js";
|
|
7
|
+
export * from "../perfLogger.js";
|
|
8
|
+
export * from "../types.js";
|
|
9
|
+
export * from "../path.js";
|
|
10
|
+
export * from "../diagnosticInformationMap.generated.js";
|
|
11
|
+
export * from "../scanner.js";
|
|
12
|
+
export * from "../utilitiesPublic.js";
|
|
13
|
+
export * from "../utilities.js";
|
|
14
|
+
export * from "../parser.js";
|
|
15
|
+
export * from "../factoryPublic.js";
|
|
16
|
+
export * from "../factory.js";
|
|
17
|
+
export * from "../visitorPublic.js";
|
|
18
|
+
export * from "../visitor.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// O namespace `ts` do outFile da tag, na parte da parse tree, na ordem do `src/compiler/tsconfig.json`: carregar este
|
|
2
|
+
// barril avalia os arquivos nessa ordem. O binder e o checker estendem o namespace nos barris deles, como os projetos
|
|
3
|
+
// da tag estendiam o mesmo `namespace ts`.
|
|
4
|
+
export * from "../shims/mapShim.js";
|
|
5
|
+
export * from "../corePublic.js";
|
|
6
|
+
export * from "../core.js";
|
|
7
|
+
export * from "../debug.js";
|
|
8
|
+
export * from "../performanceTimestamp.js";
|
|
9
|
+
export * as performance from "./ts.performance.js";
|
|
10
|
+
export * from "../perfLogger.js";
|
|
11
|
+
export * from "../types.js";
|
|
12
|
+
export * from "../path.js";
|
|
13
|
+
export * from "../diagnosticInformationMap.generated.js";
|
|
14
|
+
export * from "../scanner.js";
|
|
15
|
+
export * from "../utilitiesPublic.js";
|
|
16
|
+
export * from "../utilities.js";
|
|
17
|
+
export * from "../parser.js";
|
|
18
|
+
export * from "../factoryPublic.js";
|
|
19
|
+
export * from "../factory.js";
|
|
20
|
+
export * from "../visitorPublic.js";
|
|
21
|
+
export * from "../visitor.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../performance.js";
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { Comparison, Map } from "./_namespaces/ts.js";
|
|
2
|
+
import type { Comparer, EqualityComparer, Iterator, MapLike, ReadonlyMap, Push, SortedArray, SortedReadonlyArray, UnderscoreEscapedMap, __String } from "./_namespaces/ts.js";
|
|
3
|
+
export declare const emptyArray: never[];
|
|
4
|
+
/** Create a new map. */
|
|
5
|
+
export declare function createMap<T>(): Map<T>;
|
|
6
|
+
/** Create a new map from an array of entries. */
|
|
7
|
+
export declare function createMapFromEntries<T>(entries: [string, T][]): Map<T>;
|
|
8
|
+
/** Create a new map from a template object is provided, the map will copy entries from it. */
|
|
9
|
+
export declare function createMapFromTemplate<T>(template: MapLike<T>): Map<T>;
|
|
10
|
+
export declare function length(array: readonly any[] | undefined): number;
|
|
11
|
+
/**
|
|
12
|
+
* Iterates through 'array' by index and performs the callback on each element of array until the callback
|
|
13
|
+
* returns a truthy value, then returns that value.
|
|
14
|
+
* If no such value is found, the callback is applied to each element of array and undefined is returned.
|
|
15
|
+
*/
|
|
16
|
+
export declare function forEach<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Like `forEach`, but iterates in reverse order.
|
|
19
|
+
*/
|
|
20
|
+
export declare function forEachRight<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
|
|
21
|
+
/** Like `forEach`, but suitable for use with numbers and strings (which may be falsy). */
|
|
22
|
+
export declare function firstDefined<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Iterates through `array` by index and performs the callback on each element of array until the callback
|
|
25
|
+
* returns a falsey value, then returns false.
|
|
26
|
+
* If no such value is found, the callback is applied to each element of array and `true` is returned.
|
|
27
|
+
*/
|
|
28
|
+
export declare function every<T>(array: readonly T[], callback: (element: T, index: number) => boolean): boolean;
|
|
29
|
+
/** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */
|
|
30
|
+
export declare function find<T, U extends T>(array: readonly T[], predicate: (element: T, index: number) => element is U): U | undefined;
|
|
31
|
+
export declare function find<T>(array: readonly T[], predicate: (element: T, index: number) => boolean): T | undefined;
|
|
32
|
+
export declare function findLast<T, U extends T>(array: readonly T[], predicate: (element: T, index: number) => element is U): U | undefined;
|
|
33
|
+
export declare function findLast<T>(array: readonly T[], predicate: (element: T, index: number) => boolean): T | undefined;
|
|
34
|
+
/** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */
|
|
35
|
+
export declare function findIndex<T>(array: readonly T[], predicate: (element: T, index: number) => boolean, startIndex?: number): number;
|
|
36
|
+
export declare function findLastIndex<T>(array: readonly T[], predicate: (element: T, index: number) => boolean, startIndex?: number): number;
|
|
37
|
+
export declare function contains<T>(array: readonly T[] | undefined, value: T, equalityComparer?: EqualityComparer<T>): boolean;
|
|
38
|
+
export declare function arraysEqual<T>(a: readonly T[], b: readonly T[], equalityComparer?: EqualityComparer<T>): boolean;
|
|
39
|
+
export declare function countWhere<T>(array: readonly T[], predicate: (x: T, i: number) => boolean): number;
|
|
40
|
+
/**
|
|
41
|
+
* Filters an array by a predicate function. Returns the same array instance if the predicate is
|
|
42
|
+
* true for all elements, otherwise returns a new array instance containing the filtered subset.
|
|
43
|
+
*/
|
|
44
|
+
export declare function filter<T, U extends T>(array: T[], f: (x: T) => x is U): U[];
|
|
45
|
+
export declare function filter<T>(array: T[], f: (x: T) => boolean): T[];
|
|
46
|
+
export declare function filter<T, U extends T>(array: readonly T[], f: (x: T) => x is U): readonly U[];
|
|
47
|
+
export declare function filter<T>(array: readonly T[], f: (x: T) => boolean): readonly T[];
|
|
48
|
+
export declare function filter<T, U extends T>(array: T[] | undefined, f: (x: T) => x is U): U[] | undefined;
|
|
49
|
+
export declare function filter<T>(array: T[] | undefined, f: (x: T) => boolean): T[] | undefined;
|
|
50
|
+
export declare function filter<T, U extends T>(array: readonly T[] | undefined, f: (x: T) => x is U): readonly U[] | undefined;
|
|
51
|
+
export declare function filter<T>(array: readonly T[] | undefined, f: (x: T) => boolean): readonly T[] | undefined;
|
|
52
|
+
export declare function filterMutate<T>(array: T[], f: (x: T, i: number, array: T[]) => boolean): void;
|
|
53
|
+
export declare function clear(array: {}[]): void;
|
|
54
|
+
export declare function map<T, U>(array: readonly T[], f: (x: T, i: number) => U): U[];
|
|
55
|
+
export declare function map<T, U>(array: readonly T[] | undefined, f: (x: T, i: number) => U): U[] | undefined;
|
|
56
|
+
export declare function sameMap<T>(array: T[], f: (x: T, i: number) => T): T[];
|
|
57
|
+
export declare function sameMap<T>(array: readonly T[], f: (x: T, i: number) => T): readonly T[];
|
|
58
|
+
export declare function sameMap<T>(array: T[] | undefined, f: (x: T, i: number) => T): T[] | undefined;
|
|
59
|
+
export declare function sameMap<T>(array: readonly T[] | undefined, f: (x: T, i: number) => T): readonly T[] | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Flattens an array containing a mix of array or non-array elements.
|
|
62
|
+
*
|
|
63
|
+
* @param array The array to flatten.
|
|
64
|
+
*/
|
|
65
|
+
export declare function flatten<T>(array: T[][] | readonly (T | readonly T[] | undefined)[]): T[];
|
|
66
|
+
/**
|
|
67
|
+
* Maps an array. If the mapped value is an array, it is spread into the result.
|
|
68
|
+
*
|
|
69
|
+
* @param array The array to map.
|
|
70
|
+
* @param mapfn The callback used to map the result into one or more values.
|
|
71
|
+
*/
|
|
72
|
+
export declare function flatMap<T, U>(array: readonly T[] | undefined, mapfn: (x: T, i: number) => U | readonly U[] | undefined): readonly U[];
|
|
73
|
+
export declare function flatMapToMutable<T, U>(array: readonly T[] | undefined, mapfn: (x: T, i: number) => U | readonly U[] | undefined): U[];
|
|
74
|
+
export declare function flatMapIterator<T, U>(iter: Iterator<T>, mapfn: (x: T) => readonly U[] | Iterator<U> | undefined): Iterator<U>;
|
|
75
|
+
/**
|
|
76
|
+
* Maps an array. If the mapped value is an array, it is spread into the result.
|
|
77
|
+
* Avoids allocation if all elements map to themselves.
|
|
78
|
+
*
|
|
79
|
+
* @param array The array to map.
|
|
80
|
+
* @param mapfn The callback used to map the result into one or more values.
|
|
81
|
+
*/
|
|
82
|
+
export declare function sameFlatMap<T>(array: T[], mapfn: (x: T, i: number) => T | readonly T[]): T[];
|
|
83
|
+
export declare function sameFlatMap<T>(array: readonly T[], mapfn: (x: T, i: number) => T | readonly T[]): readonly T[];
|
|
84
|
+
export declare function mapDefined<T, U>(array: readonly T[] | undefined, mapFn: (x: T, i: number) => U | undefined): U[];
|
|
85
|
+
export declare const emptyIterator: Iterator<never>;
|
|
86
|
+
export declare function mapEntries<T, U>(map: ReadonlyMap<T>, f: (key: string, value: T) => [string, U]): Map<U>;
|
|
87
|
+
export declare function mapEntries<T, U>(map: ReadonlyMap<T> | undefined, f: (key: string, value: T) => [string, U]): Map<U> | undefined;
|
|
88
|
+
export declare function some<T>(array: readonly T[] | undefined): array is readonly T[];
|
|
89
|
+
export declare function some<T>(array: readonly T[] | undefined, predicate: (value: T) => boolean): boolean;
|
|
90
|
+
/** Calls the callback with (start, afterEnd) index pairs for each range where 'pred' is true. */
|
|
91
|
+
export declare function getRangesWhere<T>(arr: readonly T[], pred: (t: T) => boolean, cb: (start: number, afterEnd: number) => void): void;
|
|
92
|
+
export declare function concatenate<T>(array1: T[], array2: T[]): T[];
|
|
93
|
+
export declare function concatenate<T>(array1: readonly T[], array2: readonly T[]): readonly T[];
|
|
94
|
+
export declare function concatenate<T>(array1: T[] | undefined, array2: T[] | undefined): T[];
|
|
95
|
+
export declare function concatenate<T>(array1: readonly T[] | undefined, array2: readonly T[] | undefined): readonly T[];
|
|
96
|
+
export declare function indicesOf(array: readonly unknown[]): number[];
|
|
97
|
+
/**
|
|
98
|
+
* Deduplicates an unsorted array.
|
|
99
|
+
* @param equalityComparer An `EqualityComparer` used to determine if two values are duplicates.
|
|
100
|
+
* @param comparer An optional `Comparer` used to sort entries before comparison, though the
|
|
101
|
+
* result will remain in the original order in `array`.
|
|
102
|
+
*/
|
|
103
|
+
export declare function deduplicate<T>(array: readonly T[], equalityComparer: EqualityComparer<T>, comparer?: Comparer<T>): T[];
|
|
104
|
+
export declare function insertSorted<T>(array: SortedArray<T>, insert: T, compare: Comparer<T>): void;
|
|
105
|
+
export declare function sortAndDeduplicate(array: readonly string[]): SortedReadonlyArray<string>;
|
|
106
|
+
export declare function sortAndDeduplicate<T>(array: readonly T[], comparer: Comparer<T>, equalityComparer?: EqualityComparer<T>): SortedReadonlyArray<T>;
|
|
107
|
+
export declare function arrayIsEqualTo<T>(array1: readonly T[] | undefined, array2: readonly T[] | undefined, equalityComparer?: (a: T, b: T, index: number) => boolean): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Compacts an array, removing any falsey elements.
|
|
110
|
+
*/
|
|
111
|
+
export declare function compact<T>(array: (T | undefined | null | false | 0 | "")[]): T[];
|
|
112
|
+
export declare function compact<T>(array: readonly (T | undefined | null | false | 0 | "")[]): readonly T[];
|
|
113
|
+
export declare function compact<T>(array: T[]): T[];
|
|
114
|
+
export declare function compact<T>(array: readonly T[]): readonly T[];
|
|
115
|
+
/**
|
|
116
|
+
* Gets the relative complement of `arrayA` with respect to `arrayB`, returning the elements that
|
|
117
|
+
* are not present in `arrayA` but are present in `arrayB`. Assumes both arrays are sorted
|
|
118
|
+
* based on the provided comparer.
|
|
119
|
+
*/
|
|
120
|
+
export declare function relativeComplement<T>(arrayA: T[] | undefined, arrayB: T[] | undefined, comparer: Comparer<T>): T[] | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Appends a value to an array, returning the array.
|
|
123
|
+
*
|
|
124
|
+
* @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array
|
|
125
|
+
* is created if `value` was appended.
|
|
126
|
+
* @param value The value to append to the array. If `value` is `undefined`, nothing is
|
|
127
|
+
* appended.
|
|
128
|
+
*/
|
|
129
|
+
export declare function append<TArray extends any[] | undefined, TValue extends NonNullable<TArray>[number] | undefined>(to: TArray, value: TValue): [undefined, undefined] extends [TArray, TValue] ? TArray : NonNullable<TArray>[number][];
|
|
130
|
+
export declare function append<T>(to: T[], value: T | undefined): T[];
|
|
131
|
+
export declare function append<T>(to: T[] | undefined, value: T): T[];
|
|
132
|
+
export declare function append<T>(to: T[] | undefined, value: T | undefined): T[] | undefined;
|
|
133
|
+
export declare function append<T>(to: Push<T>, value: T | undefined): void;
|
|
134
|
+
/**
|
|
135
|
+
* Combines two arrays, values, or undefineds into the smallest container that can accommodate the resulting set:
|
|
136
|
+
*
|
|
137
|
+
* ```
|
|
138
|
+
* undefined -> undefined -> undefined
|
|
139
|
+
* T -> undefined -> T
|
|
140
|
+
* T -> T -> T[]
|
|
141
|
+
* T[] -> undefined -> T[] (no-op)
|
|
142
|
+
* T[] -> T -> T[] (append)
|
|
143
|
+
* T[] -> T[] -> T[] (concatenate)
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare function combine<T>(xs: T | readonly T[] | undefined, ys: T | readonly T[] | undefined): T | readonly T[] | undefined;
|
|
147
|
+
export declare function combine<T>(xs: T | T[] | undefined, ys: T | T[] | undefined): T | T[] | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Appends a range of value to an array, returning the array.
|
|
150
|
+
*
|
|
151
|
+
* @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array
|
|
152
|
+
* is created if `value` was appended.
|
|
153
|
+
* @param from The values to append to the array. If `from` is `undefined`, nothing is
|
|
154
|
+
* appended. If an element of `from` is `undefined`, that element is not appended.
|
|
155
|
+
* @param start The offset in `from` at which to start copying values.
|
|
156
|
+
* @param end The offset in `from` at which to stop copying values (non-inclusive).
|
|
157
|
+
*/
|
|
158
|
+
export declare function addRange<T>(to: T[], from: readonly T[] | undefined, start?: number, end?: number): T[];
|
|
159
|
+
export declare function addRange<T>(to: T[] | undefined, from: readonly T[] | undefined, start?: number, end?: number): T[] | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* @return Whether the value was added.
|
|
162
|
+
*/
|
|
163
|
+
export declare function pushIfUnique<T>(array: T[], toAdd: T, equalityComparer?: EqualityComparer<T>): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Unlike `pushIfUnique`, this can take `undefined` as an input, and returns a new array.
|
|
166
|
+
*/
|
|
167
|
+
export declare function appendIfUnique<T>(array: T[] | undefined, toAdd: T, equalityComparer?: EqualityComparer<T>): T[];
|
|
168
|
+
/**
|
|
169
|
+
* Returns a new sorted array.
|
|
170
|
+
*/
|
|
171
|
+
export declare function sort<T>(array: readonly T[], comparer?: Comparer<T>): SortedReadonlyArray<T>;
|
|
172
|
+
export declare function arrayIterator<T>(array: readonly T[]): Iterator<T>;
|
|
173
|
+
/**
|
|
174
|
+
* Stable sort of an array. Elements equal to each other maintain their relative position in the array.
|
|
175
|
+
*/
|
|
176
|
+
export declare function stableSort<T>(array: readonly T[], comparer: Comparer<T>): SortedReadonlyArray<T>;
|
|
177
|
+
export declare function rangeEquals<T>(array1: readonly T[], array2: readonly T[], pos: number, end: number): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Returns the element at a specific offset in an array if non-empty, `undefined` otherwise.
|
|
180
|
+
* A negative offset indicates the element should be retrieved from the end of the array.
|
|
181
|
+
*/
|
|
182
|
+
export declare function elementAt<T>(array: readonly T[] | undefined, offset: number): T | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Returns the first element of an array if non-empty, `undefined` otherwise.
|
|
185
|
+
*/
|
|
186
|
+
export declare function firstOrUndefined<T>(array: readonly T[]): T | undefined;
|
|
187
|
+
export declare function first<T>(array: readonly T[]): T;
|
|
188
|
+
/**
|
|
189
|
+
* Returns the last element of an array if non-empty, `undefined` otherwise.
|
|
190
|
+
*/
|
|
191
|
+
export declare function lastOrUndefined<T>(array: readonly T[]): T | undefined;
|
|
192
|
+
export declare function last<T>(array: readonly T[]): T;
|
|
193
|
+
/**
|
|
194
|
+
* Returns the only element of an array if it contains only one element, `undefined` otherwise.
|
|
195
|
+
*/
|
|
196
|
+
export declare function singleOrUndefined<T>(array: readonly T[] | undefined): T | undefined;
|
|
197
|
+
export declare function replaceElement<T>(array: readonly T[], index: number, value: T): T[];
|
|
198
|
+
/**
|
|
199
|
+
* Performs a binary search, finding the index at which `value` occurs in `array`.
|
|
200
|
+
* If no such index is found, returns the 2's-complement of first index at which
|
|
201
|
+
* `array[index]` exceeds `value`.
|
|
202
|
+
* @param array A sorted array whose first element must be no larger than number
|
|
203
|
+
* @param value The value to be searched for in the array.
|
|
204
|
+
* @param keySelector A callback used to select the search key from `value` and each element of
|
|
205
|
+
* `array`.
|
|
206
|
+
* @param keyComparer A callback used to compare two keys in a sorted array.
|
|
207
|
+
* @param offset An offset into `array` at which to start the search.
|
|
208
|
+
*/
|
|
209
|
+
export declare function binarySearch<T, U>(array: readonly T[], value: T, keySelector: (v: T) => U, keyComparer: Comparer<U>, offset?: number): number;
|
|
210
|
+
/**
|
|
211
|
+
* Performs a binary search, finding the index at which an object with `key` occurs in `array`.
|
|
212
|
+
* If no such index is found, returns the 2's-complement of first index at which
|
|
213
|
+
* `array[index]` exceeds `key`.
|
|
214
|
+
* @param array A sorted array whose first element must be no larger than number
|
|
215
|
+
* @param key The key to be searched for in the array.
|
|
216
|
+
* @param keySelector A callback used to select the search key from each element of `array`.
|
|
217
|
+
* @param keyComparer A callback used to compare two keys in a sorted array.
|
|
218
|
+
* @param offset An offset into `array` at which to start the search.
|
|
219
|
+
*/
|
|
220
|
+
export declare function binarySearchKey<T, U>(array: readonly T[], key: U, keySelector: (v: T) => U, keyComparer: Comparer<U>, offset?: number): number;
|
|
221
|
+
export declare function reduceLeft<T, U>(array: readonly T[] | undefined, f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U;
|
|
222
|
+
export declare function reduceLeft<T>(array: readonly T[], f: (memo: T, value: T, i: number) => T): T | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Indicates whether a map-like contains an own property with the specified key.
|
|
225
|
+
*
|
|
226
|
+
* @param map A map-like.
|
|
227
|
+
* @param key A property key.
|
|
228
|
+
*/
|
|
229
|
+
export declare function hasProperty(map: MapLike<any>, key: string): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Gets the value of an owned property in a map-like.
|
|
232
|
+
*
|
|
233
|
+
* @param map A map-like.
|
|
234
|
+
* @param key A property key.
|
|
235
|
+
*/
|
|
236
|
+
export declare function getProperty<T>(map: MapLike<T>, key: string): T | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* Gets the owned, enumerable property keys of a map-like.
|
|
239
|
+
*/
|
|
240
|
+
export declare function getOwnKeys<T>(map: MapLike<T>): string[];
|
|
241
|
+
export declare function getOwnValues<T>(sparseArray: T[]): T[];
|
|
242
|
+
/** Shims `Array.from`. */
|
|
243
|
+
export declare function arrayFrom<T, U>(iterator: Iterator<T> | IterableIterator<T>, map: (t: T) => U): U[];
|
|
244
|
+
export declare function arrayFrom<T>(iterator: Iterator<T> | IterableIterator<T>): T[];
|
|
245
|
+
export declare function assign<T extends object>(t: T, ...args: (T | undefined)[]): T;
|
|
246
|
+
/**
|
|
247
|
+
* O mapa dos elementos de um array, cada um sob a chave que o `makeKey` dá a ele. Dois elementos com a mesma chave não
|
|
248
|
+
* são erro: fica o de índice maior.
|
|
249
|
+
*/
|
|
250
|
+
export declare function arrayToMap<T>(array: readonly T[], makeKey: (value: T) => string | undefined): Map<T>;
|
|
251
|
+
export declare function arrayToMap<T, U>(array: readonly T[], makeKey: (value: T) => string | undefined, makeValue: (value: T) => U): Map<U>;
|
|
252
|
+
export declare function arrayToMultiMap<T>(values: readonly T[], makeKey: (value: T) => string): MultiMap<T>;
|
|
253
|
+
export declare function arrayToMultiMap<T, U>(values: readonly T[], makeKey: (value: T) => string, makeValue: (value: T) => U): MultiMap<U>;
|
|
254
|
+
export declare function group<T>(values: readonly T[], getGroupId: (value: T) => string): readonly (readonly T[])[];
|
|
255
|
+
export declare function group<T, R>(values: readonly T[], getGroupId: (value: T) => string, resultSelector: (values: readonly T[]) => R): R[];
|
|
256
|
+
export declare function clone<T>(object: T): T;
|
|
257
|
+
/**
|
|
258
|
+
* Creates a new object by adding the own properties of `second`, then the own properties of `first`.
|
|
259
|
+
*
|
|
260
|
+
* NOTE: This means that if a property exists in both `first` and `second`, the property in `first` will be chosen.
|
|
261
|
+
*/
|
|
262
|
+
export declare function extend<T1, T2>(first: T1, second: T2): T1 & T2;
|
|
263
|
+
export declare function maybeBind<T, A extends any[], R>(obj: T, fn: ((this: T, ...args: A) => R) | undefined): ((...args: A) => R) | undefined;
|
|
264
|
+
export interface MultiMap<T> extends Map<T[]> {
|
|
265
|
+
/**
|
|
266
|
+
* Adds the value to an array of values associated with the key, and returns the array.
|
|
267
|
+
* Creates the array if it does not already exist.
|
|
268
|
+
*/
|
|
269
|
+
add(key: string, value: T): T[];
|
|
270
|
+
/**
|
|
271
|
+
* Removes a value from an array of values associated with the key.
|
|
272
|
+
* Does not preserve the order of those values.
|
|
273
|
+
* Does nothing if `key` is not in `map`, or `value` is not in `map[key]`.
|
|
274
|
+
*/
|
|
275
|
+
remove(key: string, value: T): void;
|
|
276
|
+
}
|
|
277
|
+
export declare function createMultiMap<T>(): MultiMap<T>;
|
|
278
|
+
export interface UnderscoreEscapedMultiMap<T> extends UnderscoreEscapedMap<T[]> {
|
|
279
|
+
/**
|
|
280
|
+
* Adds the value to an array of values associated with the key, and returns the array.
|
|
281
|
+
* Creates the array if it does not already exist.
|
|
282
|
+
*/
|
|
283
|
+
add(key: __String, value: T): T[];
|
|
284
|
+
/**
|
|
285
|
+
* Removes a value from an array of values associated with the key.
|
|
286
|
+
* Does not preserve the order of those values.
|
|
287
|
+
* Does nothing if `key` is not in `map`, or `value` is not in `map[key]`.
|
|
288
|
+
*/
|
|
289
|
+
remove(key: __String, value: T): void;
|
|
290
|
+
}
|
|
291
|
+
export declare function createUnderscoreEscapedMultiMap<T>(): UnderscoreEscapedMultiMap<T>;
|
|
292
|
+
/**
|
|
293
|
+
* Tests whether a value is an array.
|
|
294
|
+
*/
|
|
295
|
+
export declare function isArray(value: any): value is readonly unknown[];
|
|
296
|
+
export declare function toArray<T>(value: T | T[]): T[];
|
|
297
|
+
export declare function toArray<T>(value: T | readonly T[]): readonly T[];
|
|
298
|
+
/**
|
|
299
|
+
* Tests whether a value is string
|
|
300
|
+
*/
|
|
301
|
+
export declare function isString(text: unknown): text is string;
|
|
302
|
+
export declare function isNumber(x: unknown): x is number;
|
|
303
|
+
export declare function tryCast<TOut extends TIn, TIn = any>(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut | undefined;
|
|
304
|
+
export declare function tryCast<T>(value: T, test: (value: T) => boolean): T | undefined;
|
|
305
|
+
export declare function cast<TOut extends TIn, TIn = any>(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut;
|
|
306
|
+
/** Does nothing. */
|
|
307
|
+
export declare function noop(_?: {} | null | undefined): void;
|
|
308
|
+
export declare function returnTrue(): true;
|
|
309
|
+
/** Do nothing and return undefined */
|
|
310
|
+
export declare function returnUndefined(): undefined;
|
|
311
|
+
/** Returns its argument. */
|
|
312
|
+
export declare function identity<T>(x: T): T;
|
|
313
|
+
/** Returns lower case string */
|
|
314
|
+
export declare function toLowerCase(x: string): string;
|
|
315
|
+
/**
|
|
316
|
+
* Case insensitive file systems have descripencies in how they handle some characters (eg. turkish Upper case I with dot on top - \u0130)
|
|
317
|
+
* This function is used in places where we want to make file name as a key on these systems
|
|
318
|
+
* It is possible on mac to be able to refer to file name with I with dot on top as a fileName with its lower case form
|
|
319
|
+
* But on windows we cannot. Windows can have fileName with I with dot on top next to its lower case and they can not each be referred with the lowercase forms
|
|
320
|
+
* Technically we would want this function to be platform sepcific as well but
|
|
321
|
+
* our api has till now only taken caseSensitive as the only input and just for some characters we dont want to update API and ensure all customers use those api
|
|
322
|
+
* We could use upper case and we would still need to deal with the descripencies but
|
|
323
|
+
* we want to continue using lower case since in most cases filenames are lowercasewe and wont need any case changes and avoid having to store another string for the key
|
|
324
|
+
* So for this function purpose, we go ahead and assume character I with dot on top it as case sensitive since its very unlikely to use lower case form of that special character
|
|
325
|
+
*/
|
|
326
|
+
export declare function toFileNameLowerCase(x: string): string;
|
|
327
|
+
/** Throws an error because a function is not implemented. */
|
|
328
|
+
export declare function notImplemented(): never;
|
|
329
|
+
export declare function memoize<T>(callback: () => T): () => T;
|
|
330
|
+
/**
|
|
331
|
+
* High-order function, composes functions. Note that functions are composed inside-out;
|
|
332
|
+
* for example, `compose(a, b)` is the equivalent of `x => b(a(x))`.
|
|
333
|
+
*
|
|
334
|
+
* @param args The functions to compose.
|
|
335
|
+
*/
|
|
336
|
+
export declare function compose<T>(...args: ((t: T) => T)[]): (t: T) => T;
|
|
337
|
+
export declare enum AssertionLevel {
|
|
338
|
+
None = 0,
|
|
339
|
+
Normal = 1,
|
|
340
|
+
Aggressive = 2,
|
|
341
|
+
VeryAggressive = 3
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Safer version of `Function` which should not be called.
|
|
345
|
+
* Every function should be assignable to this, but this should not be assignable to every function.
|
|
346
|
+
*/
|
|
347
|
+
export type AnyFunction = (...args: never[]) => void;
|
|
348
|
+
export declare function equateValues<T>(a: T, b: T): boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Compare the equality of two strings using a case-sensitive ordinal comparison.
|
|
351
|
+
*
|
|
352
|
+
* Case-sensitive comparisons compare both strings one code-point at a time using the integer
|
|
353
|
+
* value of each code-point after applying `toUpperCase` to each string. We always map both
|
|
354
|
+
* strings to their upper-case form as some unicode characters do not properly round-trip to
|
|
355
|
+
* lowercase (such as `ẞ` (German sharp capital s)).
|
|
356
|
+
*/
|
|
357
|
+
export declare function equateStringsCaseInsensitive(a: string, b: string): boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Compare the equality of two strings using a case-sensitive ordinal comparison.
|
|
360
|
+
*
|
|
361
|
+
* Case-sensitive comparisons compare both strings one code-point at a time using the
|
|
362
|
+
* integer value of each code-point.
|
|
363
|
+
*/
|
|
364
|
+
export declare function equateStringsCaseSensitive(a: string, b: string): boolean;
|
|
365
|
+
/**
|
|
366
|
+
* Compare two numeric values for their order relative to each other.
|
|
367
|
+
* To compare strings, use any of the `compareStrings` functions.
|
|
368
|
+
*/
|
|
369
|
+
export declare function compareValues(a: number | undefined, b: number | undefined): Comparison;
|
|
370
|
+
export declare function min<T>(a: T, b: T, compare: Comparer<T>): T;
|
|
371
|
+
/**
|
|
372
|
+
* Compare two strings using a case-insensitive ordinal comparison.
|
|
373
|
+
*
|
|
374
|
+
* Ordinal comparisons are based on the difference between the unicode code points of both
|
|
375
|
+
* strings. Characters with multiple unicode representations are considered unequal. Ordinal
|
|
376
|
+
* comparisons provide predictable ordering, but place "a" after "B".
|
|
377
|
+
*
|
|
378
|
+
* Case-insensitive comparisons compare both strings one code-point at a time using the integer
|
|
379
|
+
* value of each code-point after applying `toUpperCase` to each string. We always map both
|
|
380
|
+
* strings to their upper-case form as some unicode characters do not properly round-trip to
|
|
381
|
+
* lowercase (such as `ẞ` (German sharp capital s)).
|
|
382
|
+
*/
|
|
383
|
+
export declare function compareStringsCaseInsensitive(a: string, b: string): Comparison;
|
|
384
|
+
/**
|
|
385
|
+
* Compare two strings using a case-sensitive ordinal comparison.
|
|
386
|
+
*
|
|
387
|
+
* Ordinal comparisons are based on the difference between the unicode code points of both
|
|
388
|
+
* strings. Characters with multiple unicode representations are considered unequal. Ordinal
|
|
389
|
+
* comparisons provide predictable ordering, but place "a" after "B".
|
|
390
|
+
*
|
|
391
|
+
* Case-sensitive comparisons compare both strings one code-point at a time using the integer
|
|
392
|
+
* value of each code-point.
|
|
393
|
+
*/
|
|
394
|
+
export declare function compareStringsCaseSensitive(a: string | undefined, b: string | undefined): Comparison;
|
|
395
|
+
export declare function getStringComparer(ignoreCase?: boolean): typeof compareStringsCaseInsensitive;
|
|
396
|
+
/**
|
|
397
|
+
* Compare two strings in a using the case-sensitive sort behavior of the UI locale.
|
|
398
|
+
*
|
|
399
|
+
* Ordering is not predictable between different host locales, but is best for displaying
|
|
400
|
+
* ordered data for UI presentation. Characters with multiple unicode representations may
|
|
401
|
+
* be considered equal.
|
|
402
|
+
*
|
|
403
|
+
* Case-sensitive comparisons compare strings that differ in base characters, or
|
|
404
|
+
* accents/diacritic marks, or case as unequal.
|
|
405
|
+
*/
|
|
406
|
+
export declare function compareStringsCaseSensitiveUI(a: string, b: string): Comparison;
|
|
407
|
+
export declare function compareProperties<T extends {}, K extends keyof T>(a: T | undefined, b: T | undefined, key: K, comparer: Comparer<T[K]>): Comparison;
|
|
408
|
+
/** True is greater than false. */
|
|
409
|
+
export declare function compareBooleans(a: boolean, b: boolean): Comparison;
|
|
410
|
+
/**
|
|
411
|
+
* Given a name and a list of names that are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
|
|
412
|
+
* Names less than length 3 only check for case-insensitive equality, not Levenshtein distance.
|
|
413
|
+
*
|
|
414
|
+
* If there is a candidate that's the same except for case, return that.
|
|
415
|
+
* If there is a candidate that's within one edit of the name, return that.
|
|
416
|
+
* Otherwise, return the candidate with the smallest Levenshtein distance,
|
|
417
|
+
* except for candidates:
|
|
418
|
+
* * With no name
|
|
419
|
+
* * Whose length differs from the target name by more than 0.34 of the length of the name.
|
|
420
|
+
* * Whose levenshtein distance is more than 0.4 of the length of the name
|
|
421
|
+
* (0.4 allows 1 substitution/transposition for every 5 characters,
|
|
422
|
+
* and 1 insertion/deletion at 3 characters)
|
|
423
|
+
*/
|
|
424
|
+
export declare function getSpellingSuggestion<T>(name: string, candidates: T[], getName: (candidate: T) => string | undefined): T | undefined;
|
|
425
|
+
export declare function endsWith(str: string, suffix: string): boolean;
|
|
426
|
+
export declare function removeSuffix(str: string, suffix: string): string;
|
|
427
|
+
export declare function tryRemoveSuffix(str: string, suffix: string): string | undefined;
|
|
428
|
+
export declare function stringContains(str: string, substring: string): boolean;
|
|
429
|
+
/** Remove an item by index from an array, moving everything to its right one space left. */
|
|
430
|
+
export declare function orderedRemoveItemAt<T>(array: T[], index: number): void;
|
|
431
|
+
export declare function unorderedRemoveItemAt<T>(array: T[], index: number): void;
|
|
432
|
+
/** Remove the *first* occurrence of `item` from the array. */
|
|
433
|
+
export declare function unorderedRemoveItem<T>(array: T[], item: T): boolean;
|
|
434
|
+
export type GetCanonicalFileName = (fileName: string) => string;
|
|
435
|
+
export declare function createGetCanonicalFileName(useCaseSensitiveFileNames: boolean): GetCanonicalFileName;
|
|
436
|
+
/** Represents a "prefix*suffix" pattern. */
|
|
437
|
+
export interface Pattern {
|
|
438
|
+
prefix: string;
|
|
439
|
+
suffix: string;
|
|
440
|
+
}
|
|
441
|
+
export declare function startsWith(str: string, prefix: string): boolean;
|
|
442
|
+
export declare function removePrefix(str: string, prefix: string): string;
|
|
443
|
+
export declare function tryRemovePrefix(str: string, prefix: string, getCanonicalFileName?: GetCanonicalFileName): string | undefined;
|
|
444
|
+
export declare function and<T>(f: (arg: T) => boolean, g: (arg: T) => boolean): (arg: T) => boolean;
|
|
445
|
+
export declare function or<T extends unknown[]>(...fs: ((...args: T) => boolean)[]): (...args: T) => boolean;
|
|
446
|
+
export declare function not<T extends unknown[]>(fn: (...args: T) => boolean): (...args: T) => boolean;
|
|
447
|
+
export declare function assertType<T>(_: T): void;
|
|
448
|
+
export declare function singleElementArray<T>(t: T | undefined): T[] | undefined;
|
|
449
|
+
export declare function fill<T>(length: number, cb: (index: number) => T): T[];
|
|
450
|
+
export declare function cartesianProduct<T>(arrays: readonly T[][]): T[][];
|