-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[New] add
functionsHaveConfigurableNames
function on main export
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 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 |
---|---|---|
|
@@ -4,5 +4,7 @@ | |
"extends": "@ljharb", | ||
|
||
"rules": { | ||
} | ||
"func-name-matching": [2, "always"], | ||
"id-length": 1, | ||
}, | ||
} |
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,5 +1,13 @@ | ||
'use strict'; | ||
|
||
module.exports = function functionsHaveNames() { | ||
var functionsHaveNames = function functionsHaveNames() { | ||
return function f() {}.name === 'f'; | ||
}; | ||
|
||
var gOPD = Object.getOwnPropertyDescriptor; | ||
|
||
functionsHaveNames.functionsHaveConfigurableNames = function functionsHaveConfigurableNames() { | ||
return functionsHaveNames() && gOPD && !!gOPD(function () {}, 'name').configurable; | ||
}; | ||
|
||
module.exports = functionsHaveNames; |
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