Socket
Socket
Sign inDemoInstall

rename-function-calls

Package Overview
Dependencies
8
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rename-function-calls

Renames functions calls, but leaves function definitions unchanged.


Version published
Weekly downloads
22K
decreased by-7.35%
Maintainers
1
Install size
3.20 MB
Created
Weekly downloads
 

Readme

Source

rename-function-calls build status

Renames functions calls, but leaves function definitions unchanged.

var code = [ 
    'function log(s)   { console.error(s); }'
  , 'function print(s) { console.log(s); }'
  , 'print(\'hello\');'
  , 'log(\'world\');'
].join('\n')

var rename = require('rename-function-call');
var renamed = rename('log', 'print', code)
console.log(renamed);
function log(s)   { console.error(s); }
function print(s) { console.log(s); }
print('hello');
print('world');

Installation

npm install rename-function-calls

API

rename(origSrc, fromName, toName) → {string}

Replaces every function call named from with another one that is named to.

Example

rename(src, 'log', 'print'); // => log(x) becomes print(x)

Parameters:
NameTypeDescription
origSrc string

the original source

fromName string

name under which function is currently called

toName string

name to which the function calls should be renamed

Source:
Returns:

source with function calls renamed

Type
string

generated with docme

License

MIT

Keywords

FAQs

Last updated on 20 Jul 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc