Skip to content

Commit

Permalink
Add JSDocs for isFunctions and customDeepEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
igorbrasileiro committed Sep 9, 2024
1 parent faf212f commit 2e27c8f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/utils/src/deepEquals.ts
Original file line number Diff line number Diff line change
@@ -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<any>) => boolean) => {
return (a: any, b: any, _idxA: any, _idxB: any, _parentA: any, _parentB: any, state: State<any>) => {
Expand Down

0 comments on commit 2e27c8f

Please sign in to comment.