parent
27d15f40bd
commit
47982af117
2 changed files with 8 additions and 1 deletions
2
index.js
2
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';
|
||||
}
|
||||
|
||||
|
|
|
|||
7
test.js
7
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']);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue