<commit_before>var ArgumentError = require('./ArgumentError');
var topiarist = require('topiarist');

function verifierMethod(verifier, methodName) {
  return function() {
    if(!this.skipVerification) {
      if(this.argValue === undefined) throw new ArgumentError(this.argName + ' argument must be provided.');

      verifier[methodName].apply(this, arguments);
    }

    if(this.argsVerifier.argIndex < this.argsVerifier.arguments.length) {
      this.argsVerifier.constructor.pendingVerifier = this.argsVerifier;
    }

    return this.argsVerifier;
  };
}

function ArgVerifier(argsVerifier, argName, argValue) {
  this.argsVerifier = argsVerifier;
  this.argName = argName;
  this.argValue = argValue;
}

ArgVerifier.addVerifier = function(verifier) {
  for(var methodName in verifier) {
    ArgVerifier.prototype[methodName] = verifierMethod(verifier, methodName);
  }
};

Object.defineProperty(ArgVerifier.prototype, 'optionally', {
  get: function optionally() {
    if((this.argValue === undefined) || (this.argValue === null)) {
      this.skipVerification = true;
    }

    return this;
  }
});

module.exports = ArgVerifier;<commit_msg>Use call() rather than apply() to improve performance.<commit_after>var ArgumentError = require('./ArgumentError');
var topiarist = require('topiarist');

function verifierMethod(verifierMethod) {
  return function(arg) {
    if(!this.skipVerification) {
      if(this.argValue === undefined) throw new ArgumentError(this.argName + ' argument must be provided.');

      verifierMethod.call(this, arg);
    }

    if(this.argsVerifier.argIndex < this.argsVerifier.arguments.length) {
      this.argsVerifier.constructor.pendingVerifier = this.argsVerifier;
    }

    return this.argsVerifier;
  };
}

function ArgVerifier(argsVerifier, argName, argValue) {
  this.argsVerifier = argsVerifier;
  this.argName = argName;
  this.argValue = argValue;
}

ArgVerifier.addVerifier = function(verifier) {
  for(var methodName in verifier) {
    ArgVerifier.prototype[methodName] = verifierMethod(verifier[methodName]);
  }
};

Object.defineProperty(ArgVerifier.prototype, 'optionally', {
  get: function optionally() {
    if((this.argValue === undefined) || (this.argValue === null)) {
      this.skipVerification = true;
    }

    return this;
  }
});

module.exports = ArgVerifier;
{'fraction_non_alphanumeric': 0.1274131274131274, 'fraction_numerical': 0.0, 'mean_word_length': 4.360919540229885, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5271917', 'n_tokens_mistral': 722, 'n_tokens_neox': 712, 'n_words': 130}