| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3b0480d commit 7ce39b8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -387,10 +387,28 @@ function _mustCallInner(fn, criteria = 1, field) { | |||
| 387 | 387 | ||
| 388 | 388 | mustCallChecks.push(context); | |
| 389 | 389 | ||
| 390 | - return function() { | ||
| 390 | + const _return = function() { // eslint-disable-line func-style | ||
| 391 | 391 | context.actual++; | |
| 392 | 392 | return fn.apply(this, arguments); | |
| 393 | 393 | }; | |
| 394 | + // Function instances have own properties that may be relevant. | ||
| 395 | + // Let's replicate those properties to the returned function. | ||
| 396 | + // Refs: https://tc39.es/ecma262/#sec-function-instances | ||
| 397 | + Object.defineProperties(_return, { | ||
| 398 | + name: { | ||
| 399 | + value: fn.name, | ||
| 400 | + writable: false, | ||
| 401 | + enumerable: false, | ||
| 402 | + configurable: true, | ||
| 403 | + }, | ||
| 404 | + length: { | ||
| 405 | + value: fn.length, | ||
| 406 | + writable: false, | ||
| 407 | + enumerable: false, | ||
| 408 | + configurable: true, | ||
| 409 | + }, | ||
| 410 | + }); | ||
| 411 | + return _return; | ||
| 394 | 412 | } | |
| 395 | 413 | ||
| 396 | 414 | function hasMultiLocalhost() { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments