rename-function
Advanced tools
Comparing version 1.0.1 to 1.0.2
## 1.0.2 - 2016-04-14 | ||
- Release v1.0.2 / npm@v1.0.2 | ||
- fix to work correctly for anonymous function | ||
- allow passing context to anonymous function (kinda strange, lol) | ||
## 1.0.1 - 2016-04-14 | ||
@@ -4,0 +9,0 @@ - Release v1.0.1 / npm@v1.0.1 |
@@ -40,6 +40,6 @@ /*! | ||
} | ||
if (typeof name !== 'string') return fn | ||
name = typeof name === 'string' ? utils.namify(name) : false | ||
if (name === utils.getFnName(fn)) return fn | ||
name = name || '' | ||
name = utils.namify(name) | ||
var str = format('return function %s() { return fn.apply(ctx || this, arguments) }', name) | ||
@@ -46,0 +46,0 @@ var func = (new Function('fn', 'ctx', str))(fn, ctx || this) // eslint-disable-line no-new-func |
{ | ||
"name": "rename-function", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Rename a given function. Tries to be cross-platform and guaranteed. Useful when you want to preserve name of bound function. In bonus, allows passing context to the renamed function.", | ||
@@ -5,0 +5,0 @@ "repository": "tunnckoCore/rename-function", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11152