@finnair/diff
Version:
Object Diff Based on Paths And Valudes of an Object
32 lines (31 loc) • 1.17 kB
TypeScript
import { PathMatcher } from '@finnair/path';
import { Change, Diff } from './Diff.js';
export interface VersionInfoConfig {
readonly diff: Diff;
readonly previousValues?: PathMatcher[];
}
export declare class VersionInfo<L> {
readonly current: L;
readonly previous?: L | undefined;
private _changes?;
private _paths?;
private _previousValues?;
readonly config: VersionInfoConfig;
constructor(current: L, previous?: L | undefined, config?: VersionInfoConfig);
map<T>(fn: (version: L) => T, config?: VersionInfoConfig): VersionInfo<T>;
mapAsync<T>(fn: (version: L) => Promise<T>, config?: VersionInfoConfig): Promise<VersionInfo<T>>;
get changes(): undefined | Map<string, Change>;
get changedPaths(): undefined | Set<string>;
get paths(): Set<string>;
get previousValues(): any;
matches(pathExpression: string | PathMatcher): boolean;
matchesAny(pathExpressions: (string | PathMatcher)[]): boolean;
toJSON(): {
current: L;
changedPaths: string[] | undefined;
previous: any;
};
private static parsePaths;
private static matchesAnyPath;
private static toMatcher;
}