ngx-object-diff
Version:
An Angular 2+ library to compare and show object differences.
118 lines (117 loc) • 2.61 kB
TypeScript
import { DomSanitizer } from "@angular/platform-browser";
export declare class NgxObjectDiffService {
private sanitizer;
private openChar;
private closeChar;
constructor(sanitizer: DomSanitizer);
/**
* @param char
*/
setOpenChar(char: string): void;
/**
* @param char
*/
setCloseChar(char: string): void;
/**
* diff between object a and b
* @param a
* @param b
* @param shallow
* @param isOwn
* @return
*/
diff(a: Object, b: Object, shallow?: boolean, isOwn?: boolean): {
changed: string;
value: any;
};
/**
* compare and build the difference of two objects taking only its own properties into account
* @param a
* @param b
* @param shallow
*/
diffOwnProperties(a: Object, b: Object, shallow?: boolean): {
changed: string;
value: any;
};
/**
* Convert to a readable xml/html Json structure
* @param changes
* @return
* @param shallow
*/
toJsonView(changes: any, shallow?: boolean): string;
/**
* Convert to a readable xml/html Json structure
* @return
* @param obj
* @param shallow
*/
objToJsonView(object: any, shallow?: boolean): Object;
/**
* Convert to a readable xml/html Json structure
* @param changes
* @return
* @param shallow
*/
toJsonDiffView(changes: any, shallow?: boolean): string;
/**
* Convert to a readable xml/html Json structure
* Convert to a readable xml/html Json structure
* @return
* @param obj
* @param shallow
*/
private formatObjToJsonXMLString;
/**
* Convert to a readable xml/html Json structure
* @param changes
* @return
* @param shallow
*/
private formatToJsonXMLString;
private formatChangesToXMLString;
/**
* @param key
* @param diffItem
* @returns
* @param shallow
* @param diffOnly
*/
private formatChange;
/**
* @param obj
* @return
* @param shallow
*/
private inspect;
/**
* @param accumulator
* @param obj
* @see http://jsperf.com/continuation-passing-style/3
* @return
* @param shallow
*/
private _inspect;
/**
* @param key
* @return
*/
private stringifyObjectKey;
/**
* @param string
* @return
*/
private escapeHTML;
/**
* @param obj
* @returns
*/
private equalObj;
/**
* @param a
* @param b
* @returns
*/
private isValidAttr;
}