Skip to content

Commit 75fc226

Browse files
committed
[Fix] in eg FF 24, collections lack forEach
1 parent c43d332 commit 75fc226

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,20 @@ module.exports = function inspect_(obj, options, depth, seen) {
202202
}
203203
if (isMap(obj)) {
204204
var mapParts = [];
205-
mapForEach.call(obj, function (value, key) {
206-
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
207-
});
205+
if (mapForEach) {
206+
mapForEach.call(obj, function (value, key) {
207+
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
208+
});
209+
}
208210
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
209211
}
210212
if (isSet(obj)) {
211213
var setParts = [];
212-
setForEach.call(obj, function (value) {
213-
setParts.push(inspect(value, obj));
214-
});
214+
if (setForEach) {
215+
setForEach.call(obj, function (value) {
216+
setParts.push(inspect(value, obj));
217+
});
218+
}
215219
return collectionOf('Set', setSize.call(obj), setParts, indent);
216220
}
217221
if (isWeakMap(obj)) {

0 commit comments

Comments
 (0)