Adopt Function#name regular expression to accommodate different scenarios of white-spaces.

This commit is contained in:
Jürg Lehni 2013-06-12 08:49:15 -07:00
parent 7a2f577b75
commit f8c36b8276

View file

@ -14,7 +14,7 @@
if (!(function f() {}).name) {
Base.define(Function.prototype, 'name', {
get: function() {
return this.toString().match(/^function\s?(\w*)\(/)[1];
return this.toString().match(/^function\s*(\w*)\s*\(/)[1];
}
});
}