function-code
v1.0.0
Published
Turn functions into strings
Downloads
2
Readme
function-code
Turn functions into strings
npm install function-code
var functionCode = require('function-code');
functionCode(fn, args...)
console.log(functionCode(function (a, b) {
return a + b;
}, 2, 2));
Outputs
(function (a, b) {
return a + b;
}(2,2))
functionCode.inline(fn, args...)
var functionCode = require('function-code');
console.log(functionCode.inline(function (a, b) {
var a = 1,
b = 2;
console.log('a + b = ', a + b);
}));
Outputs
var a = 1,
b = 2;
console.log('a + b = ', a + b);
functionCode.code(fn, args...)
Alias to functionCode(fn, args...)
Function.prototype.toCode(args...)
Alias to functionCode(this, args...)
Function.prototype.toInline()
Alias to functionCode.inline(this)