Socket
Book a DemoInstallSign in
Socket

function-code

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

function-code

Turn functions into strings

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

function-code Build Status

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)

Keywords

function

FAQs

Package last updated on 21 Aug 2015

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