Add eqeqeq rule but require == for null
This commit is contained in:
parent
64a4d2e717
commit
0086216c9d
30 changed files with 64 additions and 63 deletions
|
@ -8,6 +8,7 @@ export type NullToUndefined<T> = Extract<T, null> extends never
|
|||
export function dropNull<T>(
|
||||
value: NonNullable<T> | null | undefined
|
||||
): T | undefined {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (value === null) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -22,7 +23,7 @@ export function shallowDropNull<O extends { [key: string]: any }>(
|
|||
[Property in keyof O]: NullToUndefined<O[Property]>;
|
||||
}
|
||||
| undefined {
|
||||
if (value === null || value === undefined) {
|
||||
if (value == null) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export function isNotNil<T>(value: T | null | undefined): value is T {
|
||||
if (value === null || value === undefined) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export const isRecord = (value: unknown): value is Record<string, unknown> =>
|
||||
typeof value === 'object' && !Array.isArray(value) && value !== null;
|
||||
typeof value === 'object' && !Array.isArray(value) && value != null;
|
||||
|
|
|
@ -7,7 +7,7 @@ import { getOwn } from './getOwn';
|
|||
|
||||
export function isIterable(value: unknown): value is Iterable<unknown> {
|
||||
return (
|
||||
(typeof value === 'object' && value !== null && Symbol.iterator in value) ||
|
||||
(typeof value === 'object' && value != null && Symbol.iterator in value) ||
|
||||
typeof value === 'string'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ export function memoizeByRoot<F extends Function>(
|
|||
|
||||
const wrap = (root: unknown, ...rest: Array<unknown>): unknown => {
|
||||
strictAssert(
|
||||
typeof root === 'object' && root !== null,
|
||||
typeof root === 'object' && root != null,
|
||||
'Root is not object'
|
||||
);
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ function binaryToUint8Array(
|
|||
length: number
|
||||
): Uint8Array {
|
||||
const target = get(object, path);
|
||||
if (target === null || target === undefined) {
|
||||
if (target == null) {
|
||||
throw new Error(`binaryToUint8Array: Falsey path ${path}`);
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ function binaryToUint8Array(
|
|||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function getInteger(object: any, path: string): number {
|
||||
const target = get(object, path);
|
||||
if (target === null || target === undefined) {
|
||||
if (target == null) {
|
||||
throw new Error(`getInteger: Falsey path ${path}`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue