lib/builder/type-builder.js
function buildTypeFunction(module, tlSchema) {
    var methodName = tlSchema.method;
    // Start creating the body of the new Type function
    var body =
        '\tvar self = arguments.callee;\n' +
        '\tvar callback = options.callback;\n' +
        '\tvar channel = options.channel;\n' +
        '\tif (!channel) {\n' +
        '\t\tvar msg = \'The \\\'channel\\\' option is missing, it\\\'s mandatory\';\n' +
        '\t\tself.logger.error(msg);\n' +
        '\t\tif(callback) {\n' +
        '\t\t\tcallback(new TypeError(msg));\n' +
        '\t\t}\n' +
        '\t\treturn;\n' +
        '\t}\n';
    body +=
        '\tvar reqPayload = new self.Type(options);\n' +
        '\tchannel.callMethod(reqPayload, callback);\n';
    if (logger.isDebugEnabled()) {
        logger.debug('Body for %s type function:', methodName);
        logger.debug('\n' + body);
    }
    // Create the new Type function
    var typeFunction = new Function('options', body);
    typeFunction._name = methodName;
    typeFunction.requireTypeFromBuffer = ConstructorBuilder.requireTypeFromBuffer;
    // Create the function payload class re-calling TypeBuilder constructor.
    typeFunction.Type = new ConstructorBuilder(module, tlSchema, true).getType();
    typeFunction.logger = getLogger(module + '.' + methodName);
    return typeFunction;
}
function buildTypeFunction(module, tlSchema) {
    var methodName = tlSchema.method;
    // Start creating the body of the new Type function
    var body =
        '\tvar self = arguments.callee;\n' +
        '\tvar callback = options.callback;\n' +
        '\tvar channel = options.channel;\n' +
        '\tif (!channel) {\n' +
        '\t\tvar msg = \'The \\\'channel\\\' option is missing, it\\\'s mandatory\';\n' +
        '\t\tself.logger.error(msg);\n' +
        '\t\tif(callback) {\n' +
        '\t\t\tcallback(new TypeError(msg));\n' +
        '\t\t}\n' +
        '\t\treturn;\n' +
        '\t}\n';
    body +=
        '\tvar reqPayload = new self.Type(options);\n' +
        '\tchannel.callMethod(reqPayload, callback);\n';
    if (logger.isDebugEnabled()) {
        logger.debug('Body for %s type function:', methodName);
        logger.debug('\n' + body);
    }
    // Create the new Type function
    var typeFunction = new Function('options', body);
    typeFunction._name = methodName;
    typeFunction.requireTypeFromBuffer = ConstructorBuilder.requireTypeFromBuffer;
    // Create the function payload class re-calling TypeBuilder constructor.
    typeFunction.Type = new ConstructorBuilder(module, tlSchema, true).getType();
    typeFunction.logger = getLogger(module + '.' + methodName);
    return typeFunction;
}
function buildTypeFunction ( module , tlSchema ) { var methodName = tlSchema . method ; // Start creating the body of the new Type function var body = '\tvar self = arguments.callee;\n' + '\tvar callback = options.callback;\n' + '\tvar channel = options.channel;\n' + '\tif (!channel) {\n' + '\t\tvar msg = \'The \\\'channel\\\' option is missing, it\\\'s mandatory\';\n' + '\t\tself.logger.error(msg);\n' + '\t\tif(callback) {\n' + '\t\t\tcallback(new TypeError(msg));\n' + '\t\t}\n' + '\t\treturn;\n' + '\t}\n' ; body += '\tvar reqPayload = new self.Type(options);\n' + '\tchannel.callMethod(reqPayload, callback);\n' ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( 'Body for %s type function:' , methodName ) ; logger . debug ( '\n' + body ) ; } // Create the new Type function var typeFunction = new Function ( 'options' , body ) ; typeFunction . _name = methodName ; typeFunction . requireTypeFromBuffer = ConstructorBuilder . requireTypeFromBuffer ; // Create the function payload class re-calling TypeBuilder constructor. typeFunction . Type = new ConstructorBuilder ( module , tlSchema , true ) . getType ( ) ; typeFunction . logger = getLogger ( module + '.' + methodName ) ; return typeFunction ; }
Build a new `TypeLanguage` function parsing the `TL-Schema method`
Build a new TypeLanguage function parsing the TL - Schema method