@rpack-dev/core 0.1.10 → 0.1.11-dev-a14d131
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/dist/rpack-core.d.ts
CHANGED
|
@@ -79,6 +79,91 @@ export declare abstract class RPackThread {
|
|
|
79
79
|
abstract disable(): Promise<void>;
|
|
80
80
|
abstract terminate(): Promise<void>;
|
|
81
81
|
}
|
|
82
|
+
export declare class ArrayUtils {
|
|
83
|
+
private static readonly NATURAL_COLLATOR;
|
|
84
|
+
private constructor();
|
|
85
|
+
/**
|
|
86
|
+
* Performs a binary search on the specified ordered array for the specified element.
|
|
87
|
+
* If the object is found within the array, the index of the element is returned.
|
|
88
|
+
*
|
|
89
|
+
* Let x be the position at which the element should be placed in the array.
|
|
90
|
+
* If the object is not found within the array, this method will return -(x + 1).
|
|
91
|
+
* @param array the ordered array to search
|
|
92
|
+
* @param element the element to search for
|
|
93
|
+
* @param compareFunction the function to use for comparing elements
|
|
94
|
+
* @returns the index of the element, or the insertion index
|
|
95
|
+
*/
|
|
96
|
+
static binarySearch<T>(array: Array<T>, element: T, compareFunction: (a: T, b: T) => number): number;
|
|
97
|
+
/**
|
|
98
|
+
* Performs a binary search on the specified ordered array for the specified element.
|
|
99
|
+
* The element being searched is a property of an element in the array.
|
|
100
|
+
* If the object is found within the array, the index of the element is returned.
|
|
101
|
+
*
|
|
102
|
+
* Let x be the position at which the element should be placed in the array.
|
|
103
|
+
* If the object is not found within the array, this method will return -(x + 1).
|
|
104
|
+
* @param array the ordered array to search
|
|
105
|
+
* @param element the element to search for
|
|
106
|
+
* @param compareFunction the function to use for comparing elements
|
|
107
|
+
* @param convertFunction the function to use to convert an array element to the searched type
|
|
108
|
+
* @returns the index of the element, or the insertion index
|
|
109
|
+
*/
|
|
110
|
+
static binarySearch2<T, K>(array: Array<T>, element: K, convertFunction: (element: T) => K, compareFunction: (a: K, b: K) => number): number;
|
|
111
|
+
/**
|
|
112
|
+
* Compares two arrays and returns the differences between them as added and removed elements.
|
|
113
|
+
*
|
|
114
|
+
* This method is O(n * m) where n is the length of newArray and m is the length of oldArray
|
|
115
|
+
*
|
|
116
|
+
* @param oldArray The old array to compare against
|
|
117
|
+
* @param newArray The new array to compare
|
|
118
|
+
* @param equality Optional function to determine equality between elements.
|
|
119
|
+
* Default compares elements using == operator
|
|
120
|
+
* @returns An object containing two arrays:
|
|
121
|
+
* - added: elements present in newArray but not in oldArray
|
|
122
|
+
* - removed: elements present in oldArray but not in newArray
|
|
123
|
+
*/
|
|
124
|
+
static diff<T>(oldArray: T[], newArray: T[], equality?: (a: T, b: T) => boolean): {
|
|
125
|
+
added: T[];
|
|
126
|
+
removed: T[];
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Converts an AsyncIterableIterator into an array by collecting all emitted values.
|
|
130
|
+
*
|
|
131
|
+
* @param it The AsyncIterableIterator whose values should be collected into an array.
|
|
132
|
+
* @return A promise that resolves to an array containing all items from the given AsyncIterableIterator.
|
|
133
|
+
* @template T the type of the iterator
|
|
134
|
+
*/
|
|
135
|
+
static fromAsync<T>(it: AsyncIterableIterator<T>): Promise<T[]>;
|
|
136
|
+
/**
|
|
137
|
+
* Asynchronously sorts an array with a merge sort algorithm, using an async comparator.
|
|
138
|
+
* This method is useful when comparison of elements requires asynchronous operations.
|
|
139
|
+
* After the Promise returned by this method resolves, the original array will be sorted.
|
|
140
|
+
* This same array will be used to resolve the Promise.
|
|
141
|
+
*
|
|
142
|
+
* @param array the array to be sorted
|
|
143
|
+
* @param comparator an async function that compares two elements and returns a Promise
|
|
144
|
+
* that resolves to a number (negative if a < b, zero if a = b, positive if a > b)
|
|
145
|
+
* @returns a Promise that resolves to the sorted array
|
|
146
|
+
*/
|
|
147
|
+
static asyncSort<T>(array: T[], comparator: (a: T, b: T) => Promise<number>): Promise<T[]>;
|
|
148
|
+
/**
|
|
149
|
+
* Returns a comparator function using natural sorting
|
|
150
|
+
* for the specified type, using the specified string
|
|
151
|
+
* extractor function.
|
|
152
|
+
* @param func string extractor function
|
|
153
|
+
* @template T the original type
|
|
154
|
+
* @returns the comparator function
|
|
155
|
+
*/
|
|
156
|
+
static naturalComparator<T>(func?: (element: T) => string): (a: T, b: T) => number;
|
|
157
|
+
/**
|
|
158
|
+
* Sorts the array of type T `array` naturally, with
|
|
159
|
+
* the string extractor function `func`.
|
|
160
|
+
* @param array the array to sort
|
|
161
|
+
* @param func the string extractor function
|
|
162
|
+
* @returns the same array
|
|
163
|
+
* @template T the original type
|
|
164
|
+
*/
|
|
165
|
+
static naturalSort<T>(array: T[], func?: (element: T) => string): T[];
|
|
166
|
+
}
|
|
82
167
|
export declare class AsyncIterableIteratorMirror<T, E> implements AsyncIterableIterator<T> {
|
|
83
168
|
private readonly it;
|
|
84
169
|
private readonly converter;
|
|
@@ -544,7 +629,7 @@ export declare class StringUtils {
|
|
|
544
629
|
* A collection of some utilities.
|
|
545
630
|
*/
|
|
546
631
|
export declare class Utils {
|
|
547
|
-
private
|
|
632
|
+
private constructor();
|
|
548
633
|
/**
|
|
549
634
|
* Returns the contents of the specified url.
|
|
550
635
|
*
|
|
@@ -558,85 +643,12 @@ export declare class Utils {
|
|
|
558
643
|
* @param progressConsumer a callback containing
|
|
559
644
|
*/
|
|
560
645
|
static getLargeFile(url: string, fetchOptions: RequestInit, progressConsumer: (read: number, length: number) => void): Promise<ArrayBuffer | undefined>;
|
|
561
|
-
/**
|
|
562
|
-
* Performs a binary search on the specified ordered array for the specified element.
|
|
563
|
-
* If the object is found within the array, the index of the element is returned.
|
|
564
|
-
*
|
|
565
|
-
* Let x be the position at which the element should be placed in the array.
|
|
566
|
-
* If the object is not found within the array, this method will return -(x + 1).
|
|
567
|
-
* @param array the ordered array to search
|
|
568
|
-
* @param element the element to search for
|
|
569
|
-
* @param compareFunction the function to use for comparing elements
|
|
570
|
-
* @returns the index of the element, or the insertion index
|
|
571
|
-
*/
|
|
572
|
-
static binarySearch<T>(array: Array<T>, element: T, compareFunction: (a: T, b: T) => number): number;
|
|
573
|
-
/**
|
|
574
|
-
* Performs a binary search on the specified ordered array for the specified element.
|
|
575
|
-
* The element being searched is a property of an element in the array.
|
|
576
|
-
* If the object is found within the array, the index of the element is returned.
|
|
577
|
-
*
|
|
578
|
-
* Let x be the position at which the element should be placed in the array.
|
|
579
|
-
* If the object is not found within the array, this method will return -(x + 1).
|
|
580
|
-
* @param array the ordered array to search
|
|
581
|
-
* @param element the element to search for
|
|
582
|
-
* @param compareFunction the function to use for comparing elements
|
|
583
|
-
* @param convertFunction the function to use to convert an array element to the searched type
|
|
584
|
-
* @returns the index of the element, or the insertion index
|
|
585
|
-
*/
|
|
586
|
-
static binarySearch2<T, K>(array: Array<T>, element: K, convertFunction: (element: T) => K, compareFunction: (a: K, b: K) => number): number;
|
|
587
646
|
/**
|
|
588
647
|
* Loads the image at the specified source URL in an asynchronous way.
|
|
589
648
|
* @param src the URL to load the image from
|
|
590
649
|
* @returns a Future which will complete with an Image object
|
|
591
650
|
*/
|
|
592
651
|
static loadImageAsync(src: string): Promise<HTMLImageElement>;
|
|
593
|
-
/**
|
|
594
|
-
* Returns a comparator function using natural sorting
|
|
595
|
-
* for the specified type, using the specified string
|
|
596
|
-
* extractor function.
|
|
597
|
-
* @param func string extractor function
|
|
598
|
-
* @template T the original type
|
|
599
|
-
* @returns the comparator function
|
|
600
|
-
*/
|
|
601
|
-
static naturalComparator<T>(func?: (element: T) => string): (a: T, b: T) => number;
|
|
602
|
-
/**
|
|
603
|
-
* Sorts the array of type T `array` naturally, with
|
|
604
|
-
* the string extractor function `func`.
|
|
605
|
-
* @param array the array to sort
|
|
606
|
-
* @param func the string extractor function
|
|
607
|
-
* @returns the same array
|
|
608
|
-
* @template T the original type
|
|
609
|
-
*/
|
|
610
|
-
static naturalSort<T>(array: T[], func?: (element: T) => string): T[];
|
|
611
|
-
/**
|
|
612
|
-
* Asynchronously sorts an array with a merge sort algorithm, using an async comparator.
|
|
613
|
-
* This method is useful when comparison of elements requires asynchronous operations.
|
|
614
|
-
* After the Promise returned by this method resolves, the original array will be sorted.
|
|
615
|
-
* This same array will be used to resolve the Promise.
|
|
616
|
-
*
|
|
617
|
-
* @param array the array to be sorted
|
|
618
|
-
* @param comparator an async function that compares two elements and returns a Promise
|
|
619
|
-
* that resolves to a number (negative if a < b, zero if a = b, positive if a > b)
|
|
620
|
-
* @returns a Promise that resolves to the sorted array
|
|
621
|
-
*/
|
|
622
|
-
static asyncSort<T>(array: T[], comparator: (a: T, b: T) => Promise<number>): Promise<T[]>;
|
|
623
|
-
/**
|
|
624
|
-
* Compares two arrays and returns the differences between them as added and removed elements.
|
|
625
|
-
*
|
|
626
|
-
* This method is O(n * m) where n is the length of newArray and m is the length of oldArray
|
|
627
|
-
*
|
|
628
|
-
* @param newArray The new array to compare
|
|
629
|
-
* @param oldArray The old array to compare against
|
|
630
|
-
* @param equality Optional function to determine equality between elements.
|
|
631
|
-
* Default compares elements using == operator
|
|
632
|
-
* @returns An object containing two arrays:
|
|
633
|
-
* - added: elements present in newArray but not in oldArray
|
|
634
|
-
* - removed: elements present in oldArray but not in newArray
|
|
635
|
-
*/
|
|
636
|
-
static diff<T>(newArray: T[], oldArray: T[], equality?: (a: T, b: T) => boolean): {
|
|
637
|
-
added: T[];
|
|
638
|
-
removed: T[];
|
|
639
|
-
};
|
|
640
652
|
static tableString<T, N extends number>(elements: T[], func: (element: T) => FixedLengthArray<string, N>, options?: TableOptions<N>): string;
|
|
641
653
|
/**
|
|
642
654
|
* Returns an array of string keys from an enum class.
|