{{#def.idlType}}
{{#def.callback}}

{{

var generateParameterList = function (method, refTypeMap){
  var callback = extractAllCallbackMethod(it);

  var returnList = [];
  if ( method.arguments ) {
    method.arguments.forEach((arg, idx) => {
      var str = '';
      if (isCallback(arg.idlType, callback)) {
        var helperClassName = getCallbackHelperClassName(arg.idlType.idlType);
        str += helperClassName;
        str += '* ';
      } else {
        str += 'const ';
        str += idlType2CxxType(arg.idlType, refTypeMap);
        str += '& ';
      }
      str += arg.name;
      returnList.push(str);
    });
  }
  return returnList.join(', ');
};

var generateImplParameterList = function (method, refTypeMap) {
  var str = generateParameterList(method, refTypeMap);
  return str.replace('v8::Local<v8::Array>', 'ArrayHelper');
};

var generateArgvList = function(method, padding) {
  padding = padding || '';
  var returnList = [];
  if (method.arguments) {
    method.arguments.forEach(arg => {
      var str = 'Nan::New(';
      str += arg.name;
      str += ')';
      if (isString(arg.idlType, it.refTypeMap)) {
        str += '.ToLocalChecked()';
      }
      returnList.push(str);
    });
  }
  return returnList.join(',\n' + padding);
};

var generateArgumentList = function (method){
  var returnList = [];
  if ( method.arguments ) {
    method.arguments.forEach(arg => {
      returnList.push(arg.name);
    });
  }
  return returnList.join(', ');
};

var generateInitList = function (method, padding){
  padding = padding || '';
  var returnList = [];
  if ( method.arguments ) {
    returnList.push(': ');
    method.arguments.forEach(arg => {
      var str = '';
      str += arg.name + '_(' + arg.name + ')';
    });
  }
  return returnList.join(',\n' + padding);
};

var generateArgsIfConditionStr = function (method, refTypeMap, callback) {
  var retVal = 'info.Length()';
  var optionalArgFound = false;
  var optionalArgCount = 0;
  const totalArgs = method.arguments.length;

  var list = [];
  if (method.arguments) {
    method.arguments.forEach((arg, idx) => {
      const argName = 'info[' + idx + ']';

      if (arg.optional) {
        ++optionalArgCount;
        optionalArgFound = true;
      }

      /* Build the condition for this argument*/
      var condition = '';
      condition += '(';
      if (arg.optional) {
        condition += '(info.Length() > ' + idx + ') ? (';
      }
      condition += argName + '->';
      condition += idlType2V8TypeCheck(arg.idlType, refTypeMap, callback);
      condition += '()';
      if (arg.optional) {
        condition += ') : true';
      }
      condition += ')';
      list.push(condition);
    });
  }

  if (optionalArgFound) {
    retVal += ' >= ' + (totalArgs - optionalArgCount);
  } else {
    retVal += ' == ' + totalArgs;
  }

  if (list.length > 0) {
    retVal += ' && ';
    retVal += '(';
    retVal += list.join(' && ');
    retVal += ')';
  }

  return retVal;
};


}}
