Skip to content

Commit

Permalink
fix(pal-browser): regression in Function.name polyfill on iOS (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
jods4 authored and EisenbergEffect committed Mar 31, 2017
1 parent fca78f1 commit 17d2eb7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/function-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ if (typeof FEATURE_NO_IE === 'undefined') {
// Fix Function#name on browsers that do not support it (IE):
function test() {}

if (!test.name) {
// Fix: don't shorten to `!test.name` as minifiers may remove the `test` function name,
// which results in `test.name === ''`, which is falsy.
if (test.name === undefined) {
Object.defineProperty(Function.prototype, 'name', {
get: function() {
let name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];
Expand Down

0 comments on commit 17d2eb7

Please sign in to comment.