Files
twenty/packages/twenty-front/src/utils/compareStrictlyExceptForNullAndUndefined.ts
T
Félix Malfait 464a480043 Continue ESLINT9 Migration (#13795)
Might already fix #13793
2025-08-10 23:25:58 +02:00

16 lines
485 B
TypeScript

import { isDefined } from 'twenty-shared/utils';
import { type Nullable } from 'twenty-ui/utilities';
// TODO: we should create a custom eslint rule that enforces the use of this function
// instead of using the `===` operator where a and b are | undefined | null
export const compareStrictlyExceptForNullAndUndefined = <A, B>(
valueA: Nullable<A>,
valueB: Nullable<B>,
) => {
if (!isDefined(valueA) && !isDefined(valueB)) {
return true;
}
return valueA === valueB;
};