/** * This file is part of spy4js which is released under MIT license. * * The LICENSE file can be found in the root directory of this project. * */ type Comparator = (arg: any) => boolean | void; /** * This function may create individual comparators * to define argument based comparison for arbitrary * nested objects. * * Returning "any" because this return value should be usable anywhere. */ declare const COMPARE: (comparator: Comparator) => any; /** * Returning "any" because this return value should be usable anywhere. */ declare const MAPPER: (from: any | any[], to: any) => any; /** * This function does make a comparison of two provided params. * * If found any difference it will return a string containing * information about the first detected difference. * * If the given params were proven "identical" this function * returns undefined. * * In first place the params are flatly checked. The checks are * in the following order: * * - identical objects * - one param is null or undefined * - object type * - regexp/string/number/date/boolean * - constructor * - keys length * - own "equals" implementation * * In second place all keys of the params are deeply checked. * Using the above flat checks for all attributes. * * Also all circular structures will be resolved and repeating * attributes will be assumed to be equal. * * @param {any} a <- any param. * @param {any} b <- any param to compare with the first param. * @param {{useOwnEquals:boolean}} config <- controls the usage of own * "equals" implementations. * * @return {string|void} <- information about the difference * of the provided arguments. */ declare const differenceOf: (a: any, b: any, config?: { useOwnEquals: boolean; }) => string | undefined; export type MessageOrError = string | Error; export type OptionalMessageOrError = MessageOrError | undefined; declare const toError: (msgOrError: OptionalMessageOrError, spyName: string) => Error; export { COMPARE, differenceOf, MAPPER, toError };