lib/ast/NixInlineJS.js
function NixInlineJS(args) {

    /* Compose the NixInlineJS function's parameters */
    var params = {};

    if(typeof args.code == "function") {
        params.codeIsFunction = true;
        params.code = args.code.toString();
    } else {
        params.codeIsFunction = false;
        params.code = args.code;
    }

    if(args.requires === undefined)
        params.requires = [];
    else
        params.requires = args.requires;

    if(args.modules === undefined)
        params.modules = [];
    else
        params.modules = args.modules;

    /* Construct function invocation object to the nijsInlineProxy */
    NixFunInvocation.call(this, {
        funExpr: new nijs.NixExpression("nijsInlineProxy"),
        paramExpr: params
    });
}
function NixInlineJS(args) {

    /* Compose the NixInlineJS function's parameters */
    var params = {};

    if(typeof args.code == "function") {
        params.codeIsFunction = true;
        params.code = args.code.toString();
    } else {
        params.codeIsFunction = false;
        params.code = args.code;
    }

    if(args.requires === undefined)
        params.requires = [];
    else
        params.requires = args.requires;

    if(args.modules === undefined)
        params.modules = [];
    else
        params.modules = args.modules;

    /* Construct function invocation object to the nijsInlineProxy */
    NixFunInvocation.call(this, {
        funExpr: new nijs.NixExpression("nijsInlineProxy"),
        paramExpr: params
    });
}
function NixInlineJS ( args ) { /* Compose the NixInlineJS function's parameters */ var params = { } ; if ( typeof args . code == "function" ) { params . codeIsFunction = true ; params . code = args . code . toString ( ) ; } else { params . codeIsFunction = false ; params . code = args . code ; } if ( args . requires === undefined ) params . requires = [ ] ; else params . requires = args . requires ; if ( args . modules === undefined ) params . modules = [ ] ; else params . modules = args . modules ; /* Construct function invocation object to the nijsInlineProxy */ NixFunInvocation . call ( this , { funExpr : new nijs . NixExpression ( "nijsInlineProxy" ) , paramExpr : params } ) ; }
Creates a new NixInlineJS instance.

@class NixInlineJS
@extends NixFunInvocation
@classdesc Creates embedded shell code in a string performing a Node.js
invocation to execute an inline JavaScript code fragment.

@constructor
@param {Object} args Arguments to the function
@param {Function} args.code A JavaScript function containing code that must be executed
@param {Object[]} args.requires An array of objects representing var-module pairs used to include CommonJS modules.
var contains the identifier of the variable, the module the path to the CommonJS module
@param {Object[]} args.module An array of Nix expressions containing Node.js packages that this function must utilise.
Creates a new NixInlineJS instance .