1. rename-function-calls
Renames functions calls, but leaves function definitions unchanged.
rename-function-calls
Package: rename-function-calls
Created by: thlorenz
Last modified: Sun, 26 Jun 2022 11:12:30 GMT
Version: 0.1.1
License: MIT
Downloads: 98,779
Repository: https://github.com/thlorenz/rename-function-calls

Install

npm install rename-function-calls
yarn add rename-function-calls

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:
Name Type Description
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

Dependencies

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code