rename-function
Advanced tools
Comparing version 0.1.0 to 1.0.0
## 1.0.0 - 2016-04-14 | ||
- Release v1.0.0 / npm@v1.0.0 | ||
- add keywords | ||
- tweaks | ||
- docs comments and readme | ||
- implement :cat2: (push to github) | ||
## 0.0.0 - 2016-04-14 | ||
- Initial commit |
26
index.js
@@ -13,2 +13,24 @@ /*! | ||
/** | ||
* > Rename given `fn` with `name`. If given `name` is same as old, | ||
* then the `fn` is just returned earlier, nothing more is done. | ||
* | ||
* **Example** | ||
* | ||
* ```js | ||
* var rename = require('rename-function') | ||
* ver getName = require('get-fn-name') | ||
* | ||
* var fn = rename(fixture () {}, 'abc') | ||
* | ||
* console.log(getName(fn)) // => 'abc' | ||
* console.log(fn.name) // => 'abc' | ||
* ``` | ||
* | ||
* @param {Function} `fn` | ||
* @param {String} `name` | ||
* @return {Function} | ||
* @api public | ||
*/ | ||
module.exports = function renameFunction (fn, name) { | ||
@@ -18,5 +40,3 @@ if (typeof fn !== 'function') { | ||
} | ||
if (typeof name !== 'string') { | ||
return fn | ||
} | ||
if (typeof name !== 'string') return fn | ||
if (name === utils.getFnName(fn)) return fn | ||
@@ -23,0 +43,0 @@ |
{ | ||
"name": "rename-function", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"description": "Rename a given function. Tries to be cross-platform and guaranteed. Useful when you want to preserve name of bound function.", | ||
@@ -22,3 +22,2 @@ "repository": "tunnckoCore/rename-function", | ||
"clean-tostring": "^1.0.0", | ||
"cleanup-coverage-code": "^1.0.3", | ||
"pre-commit": "*" | ||
@@ -31,5 +30,16 @@ }, | ||
"keywords": [ | ||
"bind", | ||
"bound", | ||
"cross", | ||
"cross-platform", | ||
"fn", | ||
"func", | ||
"function", | ||
"name", | ||
"platform", | ||
"rename", | ||
"rename-function" | ||
], | ||
"verb": { | ||
"run": true, | ||
"toc": false, | ||
@@ -39,4 +49,18 @@ "layout": "empty", | ||
"readme" | ||
] | ||
], | ||
"related": { | ||
"list": [ | ||
"parse-function", | ||
"function-arguments", | ||
"bind-context", | ||
"smart-bind", | ||
"is-bound-function", | ||
"is-async-function", | ||
"is-callback-function" | ||
] | ||
}, | ||
"lint": { | ||
"reflinks": true | ||
} | ||
} | ||
} | ||
} |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10599
3
6
76
1
1
104