mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 05:00:15 +00:00

PR-URL: https://github.com/nodejs/node/pull/43826 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
18 lines
431 B
TypeScript
18 lines
431 B
TypeScript
// Definitions by: Eddie Atkinson <https://github.com/eddie-atkinson>
|
|
|
|
type Operation = "add" | "replace" | "remove" | "move";
|
|
|
|
type DiffOps = Array<{
|
|
op: Operation;
|
|
path: Array<string | number>;
|
|
value?: any;
|
|
}>;
|
|
type PathConverter = (path: string) => string[];
|
|
|
|
export function diffApply<T extends object>(
|
|
obj: T,
|
|
diff: DiffOps,
|
|
pathConverter?: PathConverter
|
|
): T;
|
|
export const jsonPatchPathConverter: PathConverter;
|