Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • Socket score

Version published
Weekly downloads
17K
decreased by-25.29%
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:
Returns:

source with function calls renamed

Type
string

generated with docme

License

MIT

Keywords

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

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