diff --git a/index.js b/index.js index 045577f..6ee2179 100644 --- a/index.js +++ b/index.js @@ -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'; } diff --git a/test.js b/test.js index b4b50e6..7fac42f 100644 --- a/test.js +++ b/test.js @@ -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']); });