jsm-utilities
Version:
A utilities library.
34 lines (33 loc) • 1.15 kB
TypeScript
export type TUpdatedProperties<T extends object = object> = {
[K in keyof T]?: T[K] extends object & {
push?: never;
unshift?: never;
} ? TUpdatedProperties<T[K]> : {
old_value: T[K] | undefined;
new_value: T[K] | undefined;
};
};
export declare class ObjectUpdatedPropertyObject {
old_value: any;
new_value: any;
constructor(old_value: any, new_value: any);
}
export declare class ObjectUpdatedProperties<T extends object, E extends Jsm.Core.Utils.DocumentProperties<T>> {
private updates;
private _exclude;
/**
*
* @param {object} oldObj
* @param {object} newObj
* @param {true | string[]} exclude if true, it will exclude default fields of Entity.General.ICreatable and Entity.General.IHasSearchMeta
*/
constructor(oldObj: Partial<T>, newObj: Partial<T>, exclude?: true | Array<E>);
private getUpdatedProperties;
get asObject(): object;
get asArray(): {
field: Jsm.Core.Utils.DocumentProperties<T>;
old_value: any;
new_value: any;
}[];
isModified(field: Jsm.Core.Utils.DocumentProperties<T>): boolean;
}