Superdiff provides a complete and readable diff for both arrays and objects. Plus, it supports stream and file inputs for handling large datasets efficiently, is battle-tested, has zero dependencies, and is super fast.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
export const STATUS : Record < string , DiffStatus > = {
ADDED : "added" ,
EQUAL : "equal" ,
MOVED : "moved" ,
DELETED : "deleted" ,
UPDATED : "updated" ,
} ;
export type DiffStatus = "added" | "equal" | "moved" | "deleted" | "updated" ;
export type ObjectData = Record < string , any > | undefined | null ;
export type ListData = any ;
export type ListDiff = {
type : "list" ;
status : DiffStatus ;
diff : {
value : ListData ;
prevIndex : number | null ;
newIndex : number | null ;
indexDiff : number | null ;
status : DiffStatus ;
} [ ] ;
} ;
export type Subproperties = {
name : string ;
previousValue : any ;
currentValue : any ;
status : DiffStatus ;
subDiff? : Subproperties [ ] ;
} ;
export type ObjectDiff = {
type : "object" ;
status : DiffStatus ;
diff : {
property : string ;
previousValue : any ;
currentValue : any ;
status : DiffStatus ;
subPropertiesDiff? : Subproperties [ ] ;
} [ ] ;
} ;
export type DataDiff = ListDiff | ObjectDiff ;