Update checked-in dependencies
This commit is contained in:
parent
1afca056e3
commit
6989ba7bd2
3942 changed files with 55190 additions and 132206 deletions
23
node_modules/set-function-name/index.js
generated
vendored
Normal file
23
node_modules/set-function-name/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
var define = require('define-data-property');
|
||||
var hasDescriptors = require('has-property-descriptors')();
|
||||
var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
/** @type {import('.')} */
|
||||
module.exports = function setFunctionName(fn, name) {
|
||||
if (typeof fn !== 'function') {
|
||||
throw new $TypeError('`fn` is not a function');
|
||||
}
|
||||
var loose = arguments.length > 2 && !!arguments[2];
|
||||
if (!loose || functionsHaveConfigurableNames) {
|
||||
if (hasDescriptors) {
|
||||
define(/** @type {Parameters<define>[0]} */ (fn), 'name', name, true, true);
|
||||
} else {
|
||||
define(/** @type {Parameters<define>[0]} */ (fn), 'name', name);
|
||||
}
|
||||
}
|
||||
return fn;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue