mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +02:00
fix: pull isDefined functions from main so that this compiles
This commit is contained in:
parent
48d2c74a3d
commit
16dbd7b30d
8
src/lib/util/isDefined.test.ts
Normal file
8
src/lib/util/isDefined.test.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { isDefined } from './isDefined';
|
||||
|
||||
test('isDefined', () => {
|
||||
expect(isDefined(null)).toEqual(false);
|
||||
expect(isDefined(undefined)).toEqual(false);
|
||||
expect(isDefined(0)).toEqual(true);
|
||||
expect(isDefined(false)).toEqual(true);
|
||||
});
|
3
src/lib/util/isDefined.ts
Normal file
3
src/lib/util/isDefined.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const isDefined = <T>(value: T | null | undefined): value is T => {
|
||||
return value !== null && typeof value !== 'undefined';
|
||||
};
|
Loading…
Reference in New Issue
Block a user