UNPKG

@mikezimm/fps-core-v7

Version:

Library of reusable core interfaces, types and constants migrated from fps-library-v2

94 lines 4.81 kB
export type IIncludeOrIgnore = 'Ignore' | 'Include'; export interface ICompareObject { obj: any; title: string; idx: number; status: 'Match' | 'NotFound' | 'NoMatch'; } export interface IComparePair { obj1: ICompareObject; obj2: ICompareObject; } export interface ICompareKeysResult { flagKeys: string[]; flagStyle: IIncludeOrIgnore; ignoredKeys: string[]; compareKeys: string[]; keyChanges: null | any; identicalKeys: string[]; differentKeys: string[]; newKeys: string[]; success: boolean; } export declare function buildEmptyCompareResults(ignoreKeys: string[], flagStyle: IIncludeOrIgnore): ICompareKeysResult; /*** * .o88b. .d88b. .88b d88. d8888b. .d8b. d8888b. d88888b * d8P Y8 .8P Y8. 88'YbdP`88 88 `8D d8' `8b 88 `8D 88' * 8P 88 88 88 88 88 88oodD' 88ooo88 88oobY' 88ooooo * 8b 88 88 88 88 88 88~~~ 88~~~88 88`8b 88~~~~~ * Y8b d8 `8b d8' 88 88 88 88 88 88 88 `88. 88. * `Y88P' `Y88P' YP YP YP 88 YP YP 88 YD Y88888P * * * d88888b db .d8b. d888888b .d88b. d8888b. d88b d88888b .o88b. d888888b .d8888. * 88' 88 d8' `8b `~~88~~' .8P Y8. 88 `8D `8P' 88' d8P Y8 `~~88~~' 88' YP * 88ooo 88 88ooo88 88 88 88 88oooY' 88 88ooooo 8P 88 `8bo. * 88~~~ 88 88~~~88 88 88 88 88~~~b. 88 88~~~~~ 8b 88 `Y8b. * 88 88booo. 88 88 88 `8b d8' 88 8D db. 88 88. Y8b d8 88 db 8D * YP Y88888P YP YP YP `Y88P' Y8888P' Y8888P Y88888P `Y88P' YP `8888Y' * * */ /** * This function will * take 2 flat objects baselineObject & compareObject * take array of strings to compare with baselineObject keys * take flagStyle which tells to include or ignore keys found in flagKeys * * return compareKeysResult object back which gives all information regarding comparing the 2 objects * * @param baselineObject * @param compareObject * @param flagKeys * @param flagStyle * @param parseMe */ export declare function compareFlatObjects(baselineObject: any, compareObject: any, flagKeys: string[], flagStyle: IIncludeOrIgnore): ICompareKeysResult; /*** * d888b d88888b d888888b db d888888b .d8888. d888888b .d88b. d88888b * 88' Y8b 88' `~~88~~' 88 `88' 88' YP `~~88~~' .8P Y8. 88' * 88 88ooooo 88 88 88 `8bo. 88 88 88 88ooo * 88 ooo 88~~~~~ 88 88 88 `Y8b. 88 88 88 88~~~ * 88. ~8~ 88. 88 88booo. .88. db 8D 88 `8b d8' 88 * Y888P Y88888P YP Y88888P Y888888P `8888Y' YP `Y88P' YP * * * db dD d88888b db db .d8888. d888888b .d88b. .o88b. .d88b. .88b d88. d8888b. .d8b. d8888b. d88888b * 88 ,8P' 88' `8b d8' 88' YP `~~88~~' .8P Y8. d8P Y8 .8P Y8. 88'YbdP`88 88 `8D d8' `8b 88 `8D 88' * 88,8P 88ooooo `8bd8' `8bo. 88 88 88 8P 88 88 88 88 88 88oodD' 88ooo88 88oobY' 88ooooo * 88`8b 88~~~~~ 88 `Y8b. 88 88 88 8b 88 88 88 88 88 88~~~ 88~~~88 88`8b 88~~~~~ * 88 `88. 88. 88 db 8D 88 `8b d8' Y8b d8 `8b d8' 88 88 88 88 88 88 88 `88. 88. * YP YD Y88888P YP `8888Y' YP `Y88P' `Y88P' `Y88P' YP YP YP 88 YP YP 88 YD Y88888P * * */ /** * This looks for keys of a data object based on an array of strings called flagKeys. * It will return an array of actual keys from baselineObject that match the search criteria * flagKeys example: ['=Id','Date','By'] * baselineObject keys: ['Id','id','UserId','Title','ModifiedDate','CreatedBy','Category1','SubCategory1'] * * flagStyle = 'Include': compareKeys = ['Id','ModifiedDate','CreatedBy'], * NOTE: UserId would not be returned because criteria '=Id' will look for exact match. * id is not return because search is case sensitive * * flagStyle = 'Ignore': compareKeys = ['id','UserId','Title','Category1','SubCategory1'], * NOTE: Id is not included because this it will be ignored. UserId is included because '=Id' looks for exact match * ModifiedDate && CreatedBy is excluded because setting is ignore for Date and By * * @param baselineObject * @param flagKeys * @param flagStyle */ export declare function getListOfKeysToCompare(baselineObject: any, flagKeys: string[], flagStyle: IIncludeOrIgnore): ICompareKeysResult; //# sourceMappingURL=compare.d.ts.map