Skip to content

Commit fc51047

Browse files
committed
[Refactor] add early bailout to isMap and isSet checks
1 parent b614eaa commit fc51047

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function indexOf(xs, x) {
177177
}
178178

179179
function isMap(x) {
180-
if (!mapSize) {
180+
if (!mapSize || !x || typeof x !== 'object') {
181181
return false;
182182
}
183183
try {
@@ -193,7 +193,7 @@ function isMap(x) {
193193
}
194194

195195
function isSet(x) {
196-
if (!setSize) {
196+
if (!setSize || !x || typeof x !== 'object') {
197197
return false;
198198
}
199199
try {

0 commit comments

Comments
 (0)