mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-26 12:43:48 -06:00
Remove last external use of unorderedRemoveFirstItemWhere
This commit is contained in:
parent
d6aa65daf1
commit
e3a1a98113
@ -1415,7 +1415,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
/** Remove the *first* element satisfying `predicate`. */
|
||||
export function unorderedRemoveFirstItemWhere<T>(array: T[], predicate: (element: T) => boolean): void {
|
||||
function unorderedRemoveFirstItemWhere<T>(array: T[], predicate: (element: T) => boolean): void {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
if (predicate(array[i])) {
|
||||
unorderedRemoveItemAt(array, i);
|
||||
|
||||
@ -209,12 +209,13 @@ namespace ts {
|
||||
watchDirectory(directoryName: string, callback: DirectoryWatcherCallback, recursive: boolean): DirectoryWatcher {
|
||||
const path = this.toPath(directoryName);
|
||||
const callbacks = lookUp(this.watchedDirectories, path) || (this.watchedDirectories[path] = []);
|
||||
callbacks.push({ cb: callback, recursive });
|
||||
const cbWithRecursive = { cb: callback, recursive };
|
||||
callbacks.push(cbWithRecursive);
|
||||
return {
|
||||
referenceCount: 0,
|
||||
directoryName,
|
||||
close: () => {
|
||||
unorderedRemoveFirstItemWhere(callbacks, cb => cb.cb === callback);
|
||||
unorderedRemoveItem(cbWithRecursive, callbacks);
|
||||
if (!callbacks.length) {
|
||||
delete this.watchedDirectories[path];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user