Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only freeze helper args if weakmap present
- Loading branch information
Showing
5 changed files
with
36 additions
and
23 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
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
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,10 @@ | ||
export const HAS_NATIVE_WEAKMAP = (function() { | ||
// detect if `WeakMap` is even present | ||
let hasWeakMap = typeof WeakMap === 'function'; | ||
if (!hasWeakMap) { return false; } | ||
|
||
let instance = new WeakMap(); | ||
// use `Object`'s `.toString` directly to prevent us from detecting | ||
// polyfills as native weakmaps | ||
return Object.prototype.toString.call(instance) === '[object WeakMap]'; | ||
})(); |