diff --git a/index.js b/index.js index 95dd43e..cae8d95 100644 --- a/index.js +++ b/index.js @@ -1743,6 +1743,7 @@ } function test(x) { + if (x == null) return false; var missing = {}; keys.forEach (function(k) { missing[k] = k; }); for (var k in x) delete missing[k]; @@ -1816,6 +1817,7 @@ } function test(x) { + if (x == null) return false; var missing = {}; keys.forEach (function(k) { missing[k] = k; }); for (var k in x) delete missing[k]; diff --git a/test/index.js b/test/index.js index 416a6e3..26927ae 100644 --- a/test/index.js +++ b/test/index.js @@ -1007,8 +1007,8 @@ Since there is no type of which all the above values are members, the type-varia // Empty :: Type const Empty = $.RecordType ({}); - eq ($.test ([]) (Empty) (null)) (true); - eq ($.test ([]) (Empty) (undefined)) (true); + eq ($.test ([]) (Empty) (null)) (false); + eq ($.test ([]) (Empty) (undefined)) (false); eq ($.test ([]) (Empty) (false)) (true); eq ($.test ([]) (Empty) (12.34)) (true); eq ($.test ([]) (Empty) ('xyz')) (true); @@ -1264,8 +1264,8 @@ The value at position 1 is not a member of ‘{ length :: a }’. // Empty :: Type const Empty = $.NamedRecordType ('my-package/Empty') ('') ({}); - eq ($.test ([]) (Empty) (null)) (true); - eq ($.test ([]) (Empty) (undefined)) (true); + eq ($.test ([]) (Empty) (null)) (false); + eq ($.test ([]) (Empty) (undefined)) (false); eq ($.test ([]) (Empty) (false)) (true); eq ($.test ([]) (Empty) (12.34)) (true); eq ($.test ([]) (Empty) ('xyz')) (true);