Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rename-function

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rename-function - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

README.md

7

CHANGELOG.md
## 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
}
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc