UNPKG

@mikezimm/fps-core-v7

Version:

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

70 lines 5.64 kB
/*** * .d8888. d888888b d8888b. d888888b d8b db d888b d888888b d88888b db db db dD d88888b db db db db .d8b. db db db d88888b * 88' YP `~~88~~' 88 `8D `88' 888o 88 88' Y8b `88' 88' `8b d8' 88 ,8P' 88' `8b d8' 88 88 d8' `8b 88 88 88 88' * `8bo. 88 88oobY' 88 88V8o 88 88 88 88ooo `8bd8' 88,8P 88ooooo `8bd8' Y8 8P 88ooo88 88 88 88 88ooooo * `Y8b. 88 88`8b 88 88 V8o88 88 ooo 88 88~~~ 88 88`8b 88~~~~~ 88 `8b d8' 88~~~88 88 88 88 88~~~~~ * db 8D 88 88 `88. .88. 88 V888 88. ~8~ .88. 88 88 88 `88. 88. 88 `8bd8' 88 88 88booo. 88b d88 88. * `8888Y' YP 88 YD Y888888P VP V8P Y888P Y888888P YP YP YP YD Y88888P YP YP YP YP Y88888P ~Y8888P' Y88888P * * */ /** * This just takes an object, and returns a string of the Key and Value. * Used for logging * @param thisOne * @param keyNo * @param delimiter */ /*** * d888b d88888b d888888b .88b d88. .d8b. db db d8888b. d8888b. .d88b. d8888b. .d88b. d88888b db dD d88888b db db * 88' Y8b 88' `~~88~~' 88'YbdP`88 d8' `8b `8b d8' 88 `8D 88 `8D .8P Y8. 88 `8D .8P Y8. 88' 88 ,8P' 88' `8b d8' * 88 88ooooo 88 88 88 88 88ooo88 `8bd8' 88oodD' 88oobY' 88 88 88oodD' 88 88 88ooo 88,8P 88ooooo `8bd8' * 88 ooo 88~~~~~ 88 88 88 88 88~~~88 .dPYb. 88~~~ 88`8b 88 88 88~~~ 88 88 88~~~ 88`8b 88~~~~~ 88 * 88. ~8~ 88. 88 88 88 88 88 88 .8P Y8. 88 88 `88. `8b d8' 88 `8b d8' 88 88 `88. 88. 88 * Y888P Y88888P YP YP YP YP YP YP YP YP 88 88 YD `Y88P' 88 `Y88P' YP YP YD Y88888P YP * * d888888b d8b db .d88b. d8888b. d88b d88888b .o88b. d888888b .d8b. d8888b. d8888b. .d8b. db db * `88' 888o 88 .8P Y8. 88 `8D `8P' 88' d8P Y8 `~~88~~' d8' `8b 88 `8D 88 `8D d8' `8b `8b d8' * 88 88V8o 88 88 88 88oooY' 88 88ooooo 8P 88 88ooo88 88oobY' 88oobY' 88ooo88 `8bd8' * 88 88 V8o88 88 88 88~~~b. 88 88~~~~~ 8b 88 88~~~88 88`8b 88`8b 88~~~88 88 * .88. 88 V888 `8b d8' 88 8D db. 88 88. Y8b d8 88 88 88 88 `88. 88 `88. 88 88 88 * Y888888P VP V8P `Y88P' Y8888P' Y8888P Y88888P `Y88P' YP YP YP 88 YD 88 YD YP YP YP * * 2021-02-14: Copied from generic solution */ export declare function getMaxPropOfKeyInObjectArray(arr: any[], key: string, find: 'max' | 'min', filterKey?: string, filterTest?: 'eq' | 'neq', filterVal?: any): any; export declare function stringifyKeyValue(thisOne: any, keyNo: any, delimiter: string): string; export interface ICompareResult { checkForTheseItems: any[]; inThisArray: any[]; found: any[]; notFound: any[]; result: any[]; message: string; } /*** * .o88b. .d88b. .88b d88. d8888b. .d8b. d8888b. d88888b .d8b. d8888b. d8888b. .d8b. db db .d8888. * d8P Y8 .8P Y8. 88'YbdP`88 88 `8D d8' `8b 88 `8D 88' d8' `8b 88 `8D 88 `8D d8' `8b `8b d8' 88' YP * 8P 88 88 88 88 88 88oodD' 88ooo88 88oobY' 88ooooo 88ooo88 88oobY' 88oobY' 88ooo88 `8bd8' `8bo. * 8b 88 88 88 88 88 88~~~ 88~~~88 88`8b 88~~~~~ 88~~~88 88`8b 88`8b 88~~~88 88 `Y8b. * Y8b d8 `8b d8' 88 88 88 88 88 88 88 `88. 88. 88 88 88 `88. 88 `88. 88 88 88 db 8D * `Y88P' `Y88P' YP YP YP 88 YP YP 88 YD Y88888P YP YP 88 YD 88 YD YP YP YP `8888Y' * * * The original goal of this function, would be to remove objects from one array if it were in another array. * As an example, I have an array of items I want to add to a list (addItemsArray) * Then I run a process which creates another 'result' array of what things were actually added - minus any errors * The function will remove the items in the 'result' array from the 'addItemsArray. * Only the items that were not added (ie the ones that errored out) will be left... or maybe it would add a key with the result. * * * @param checkForTheseItems - this is the array of items you want to check for in the sourceArray ('inThisArray') * @param inThisArray - this is the array where you are looking for items in * @param method - this tells what to do... either flage items in 'inThisArray' with found/not found, or remove the found ones * @param keyToCheck - checkForTheseItems must have a key which has this syntax: checkValue: "Title===Training" * keyToCheck would === 'checkValue' and the value for that key must have the syntax: PropertyKey===ValueOfProperty; * In the example above, it will split Title===Training into ['Title','Training'] * Then look for all items in 'inThisArray' which have the value 'Training' in the key 'Title', and apply the method you want to apply. */ export declare function compareArrays(checkForTheseItems: any[], inThisArray: any[], method: 'AddTag' | 'ReturnNOTFound' | 'ReturnFound', keyToCheck: string, checkDelimiter: string, messsages: 'Console' | 'Alert' | 'Both' | 'None'): ICompareResult; //# sourceMappingURL=objectkeys.d.ts.map