🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

rename-function-calls

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rename-function-calls

Renames functions calls, but leaves function definitions unchanged.

0.1.1
latest
Source
npm
Version published
Weekly downloads
25K
11.9%
Maintainers
1
Weekly downloads
 
Created
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:
  • index.js , lineno 23
Returns:

source with function calls renamed

Type
string

generated with docme

License

MIT

Keywords

replace

FAQs

Package last updated on 20 Jul 2014

Did you know?

Socket

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