Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
feat(isNil): Add module isNil
Browse files Browse the repository at this point in the history
Checks if a value is null or undefined
  • Loading branch information
adambrgmn committed Jan 16, 2018
1 parent 1ffd14d commit 14c6544
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/__tests__/isNil.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import isNil from '../isNil';

test('Core.isNil', () => {
expect(isNil(null)).toBeTruthy();
expect(isNil(undefined)).toBeTruthy();
expect(isNil(() => null)).toBeFalsy();
expect(isNil({})).toBeFalsy();
expect(isNil({ foo: 'bar' })).toBeFalsy();
expect(isNil([])).toBeFalsy();
expect(isNil('a')).toBeFalsy();
expect(isNil(1)).toBeFalsy();
});
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import head from './head';
import is from './is';
import isArray from './isArray';
import isFunction from './isFunction';
import isNil from './isNil';
import isObject from './isObject';
import last from './last';
import map from './map';
Expand All @@ -36,6 +37,7 @@ export {
is,
isArray,
isFunction,
isNil,
isObject,
last,
map,
Expand Down
1 change: 1 addition & 0 deletions src/isNil.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default x => x == null;

0 comments on commit 14c6544

Please sign in to comment.