Redefine Function
Re-define functions
Install
$ npm install --save redefine-function
Usage
var redefineFunction= var Greetings = { return "Hi there." } console // Hi there console // Don't worry about it
API
redefineFunction(context, functionName, newFunction)
Name | Type | Description |
---|---|---|
Context | Object |
The context of the object or function you want to redefine |
functionName | String |
A string representation of the function you want to redefine |
newFunction | Function |
The function you want to override with |
var redefineFunction= var Greetings = { return "Hi there." } console // Hi there console // Don't worry about it
Also works with prototype functions:
var redefineFunction= Stringprototype{ return this + "!"} { return this + "!!!!!!!!"} "Hello" // #=> "Hello!" "Hello" // #=> "Hello!!!!!!!!"