-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] ensure that zloirock/core-js#144 doesn't cause false positives.
Also add `npm run test:corejs`. Relates to #4.
- Loading branch information
Showing
3 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
module.exports = function () { | ||
var mapForEach = typeof Map === 'function' ? Map.prototype.forEach : null; | ||
var setForEach = typeof Set === 'function' ? Set.prototype.forEach : null; | ||
var mapForEach = (function () { | ||
if (typeof Map !== 'function') { return null; } | ||
try { | ||
Map.prototype.forEach.call({}, function () {}); | ||
} catch (e) { | ||
return Map.prototype.forEach; | ||
} | ||
return null; | ||
}()); | ||
|
||
var setForEach = (function () { | ||
if (typeof Set !== 'function') { return null; } | ||
try { | ||
Set.prototype.forEach.call({}, function () {}); | ||
} catch (e) { | ||
return Set.prototype.forEach; | ||
} | ||
return null; | ||
}()); | ||
|
||
return { Map: mapForEach, Set: setForEach }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
require('core-js'); | ||
|
||
require('./native'); |