methodize
Makes a function behaves as a method.
Install
Download manually or with package-manager.
npm
npm install --save methodize
bower
bower install --save methodize
Example
var methodize = ; var person = firstName: 'Gaius' lastName: 'Baltar'; { return personfirstName +' '+ personlastName;}; // Methodize the function and attaches it to the person object.//// The method name is retrieved from the original function if it is a// named function.//// A custom name can be specified as a second parameter to attachTo().; // Profit :)console;
Contributions
Contributions are very welcomed, either on the documentation or on the code.
You may:
- report any issue you've encountered;
- fork and create a pull request.
License
ISC © Julien Fontanet