mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 09:35:37 -05:00
Merge from vscode 10492ba146318412cbee8b76a8c630f226914734
This commit is contained in:
23
src/sql/base/common/navigator.ts
Normal file
23
src/sql/base/common/navigator.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { INavigator as vsINavigator } from 'vs/base/common/navigator';
|
||||
|
||||
export interface INavigator<T> extends vsINavigator<T> {
|
||||
parent(): T | null;
|
||||
}
|
||||
|
||||
export class MappedNavigator<T, R> implements INavigator<R> {
|
||||
|
||||
constructor(protected navigator: INavigator<T>, private fn: (item: T | null) => R) {
|
||||
}
|
||||
|
||||
current() { return this.fn(this.navigator.current()); }
|
||||
previous() { return this.fn(this.navigator.previous()); }
|
||||
first() { return this.fn(this.navigator.first()); }
|
||||
last() { return this.fn(this.navigator.last()); }
|
||||
next() { return this.fn(this.navigator.next()); }
|
||||
parent() { return this.fn(this.navigator.parent()); }
|
||||
}
|
||||
Reference in New Issue
Block a user