Fix silly null check mistake

Fixes #13
This commit is contained in:
Sindre Sorhus 2017-10-05 11:20:39 +07:00
parent 27d15f40bd
commit 47982af117
2 changed files with 8 additions and 1 deletions

View file

@ -7,7 +7,7 @@ const isOfType = type => x => typeof x === type; // eslint-disable-line valid-ty
const isObjectOfType = type => x => getObjectType(x) === type;
const is = value => {
if (value == null) { // eslint-disable-line no-eq-null, eqeqeq
if (value === null) {
return 'null';
}

View file

@ -112,6 +112,13 @@ const testType = (t, type, exclude) => {
}
};
test('is', t => {
t.is(m(null), 'null');
t.is(m(undefined), 'undefined');
// TODO: Expand this to all the supported types. Maybe reuse `testType()` somehow.
});
test('is.undefined', t => {
testType(t, 'undefined', ['nullOrUndefined']);
});