UNPKG

ts-fusion-parser

Version:

Parser for Neos Fusion Files

50 lines (49 loc) 2.36 kB
export declare class Arrays { static arrayMergeRecursiveOverrule(firstArray: { [key: string]: any; }, secondArray: { [key: string]: any; }, doNotAddNewKeys?: boolean, emptyValuesOverride?: boolean, overrideKeys?: string[]): { [key: string]: any; }; /** * Merges two arrays recursively and "binary safe" (integer keys are overridden as well), overruling similar values in the first array ($firstArray) with the values of the second array ($secondArray) * In case of identical keys, ie. keeping the values of the second. The given $toArray closure will be used if one of the two array keys contains an array and the other not. It should return an array. * * @param array $firstArray First array * @param array $secondArray Second array, overruling the first array * @param \Closure $toArray The given callable will get a value that is not an array and has to return an array. * This is to allow custom merging of simple types with (sub) arrays * @param \Closure|null $overrideFirst The given callable will determine whether the value of the first array should be overridden. * It should have the following signature $callable($key, ?array $firstValue = null, ?array $secondValue = null): bool * @return array Resulting array where $secondArray values has overruled $firstArray values */ static arrayMergeRecursiveOverruleWithCallback(firstArray: { [key: string]: any; }, secondArray: { [key: string]: any; }, toArray: (value: any) => { [key: string]: any; }, overrideFirst?: (key: string, firstArray: { [key: string]: any; }, secondArray: { [key: string]: any; }) => boolean): { [key: string]: any; }; static unsetValueByPath(arr: { [key: string]: any; }, path: string | string[]): { [key: string]: any; }; static getValueByPath(array: { [key: string]: any; }, path: string | string[]): any; static mergeArraysRecursively(firstArray: { [key: string]: any; }, secondArray: { [key: string]: any; }, toArray: (value: any) => any, overrideFirst?: ((key: string, firstValue: any, secondValue: any) => boolean) | null): { [key: string]: any; }; }