diff --git a/packages/utils/src/deepEquals.ts b/packages/utils/src/deepEquals.ts index fb3ebfe468..61aa6fe292 100644 --- a/packages/utils/src/deepEquals.ts +++ b/packages/utils/src/deepEquals.ts @@ -1,9 +1,22 @@ import { createCustomEqual, State } from 'fast-equals'; +/** Check if all parameters are typeof function. + * + * @param a - The first element to check typeof + * @param b - The second element to check typeof + * @returns - if typeof a and b are equal to function return true, otherwise false + */ function isFunctions(a: any, b: any) { return typeof a === 'function' && typeof b === 'function'; } +/** Implements a deep equals using the `fast-equal.createCustomEqual` function, that provides a customized comparator that + * assumes all functions in objects are equivalent. + * + * @param a - The first element to compare + * @param b - The second element to compare + * @returns - True if the `a` and `b` are deeply equal, false otherwise + */ const customDeepEqual = createCustomEqual({ createInternalComparator: (comparator: (a: any, b: any, state: State) => boolean) => { return (a: any, b: any, _idxA: any, _idxB: any, _parentA: any, _parentB: any, state: State) => {