diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 18a9b46f..6c5002b8 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -40,6 +40,12 @@ const config = { 'sort-keys': 0 } }, + { + files: ['src/utils/is-falsy.ts'], + rules: { + '@typescript-eslint/strict-boolean-expressions': 0 + } + }, { files: ['src/utils/ksort.ts'], rules: { diff --git a/src/utils/__tests__/is-falsy.spec.ts b/src/utils/__tests__/is-falsy.spec.ts index 59c5b734..2bf9fb21 100644 --- a/src/utils/__tests__/is-falsy.spec.ts +++ b/src/utils/__tests__/is-falsy.spec.ts @@ -4,6 +4,7 @@ */ import VEHICLE from '#fixtures/vehicle' +import constant from '../constant' import testSubject from '../is-falsy' describe('unit:utils/isFalsy', () => { @@ -13,7 +14,7 @@ describe('unit:utils/isFalsy', () => { [1], [true], [VEHICLE], - [() => 'hello, world'] + [constant('hello, world')] ] // Act + Expect diff --git a/src/utils/is-falsy.ts b/src/utils/is-falsy.ts index 0ee5b1c4..eb6600b2 100644 --- a/src/utils/is-falsy.ts +++ b/src/utils/is-falsy.ts @@ -4,10 +4,6 @@ */ import type { Falsy } from '#src/types' -import includes from './includes' -import isEmptyValue from './is-empty-value' -import isFalse from './is-false' -import isNaN from './is-nan' /** * Checks if `value` is {@linkcode Falsy}. @@ -27,13 +23,6 @@ import isNaN from './is-nan' * @param {unknown} value - Value to check * @return {value is Falsy} `true` if `value` is falsy */ -const isFalsy = (value: unknown): value is Falsy => { - return ( - isEmptyValue(value) || - isFalse(value) || - isNaN(value) || - includes([0, 0n], value) - ) -} +const isFalsy = (value: unknown): value is Falsy => (value ? false : true) export default isFalsy