<commit_before>ko.validation.rules['assetNameIsTaken'] = {
  async: true,
  message: 'Token name is already taken',
  validator: function (val, self, callback) {
    failoverAPI("get_issuances",
      {'filters': {'field': 'asset', 'op': '==', 'value': val}},
      function(data, endpoint) {
        return data.length ? callback(false) : callback(true) //empty list -> true (valid = true)
      }
    );   
  }
};
// TODO: DRY!!
ko.validation.rules['assetNameExists'] = {
  async: true,
  message: 'Token name does not exist',
  validator: function (val, self, callback) {
    failoverAPI("get_issuances", {'filters': {'field': 'asset', 'op': '==', 'value': val}},
      function(data, endpoint) {
        $.jqlog.debug("Asset exists: " + data.length);
        return data.length ? callback(true) : callback(false) //empty list -> false (valid = false)
      }
    );   
  }
};
ko.validation.rules['isValidAssetNameLength'] = {
    validator: function (val, self) {
      //Check length
      var n = 0;
      for(var i=0; i < val.length; i++) {
        n *= 26;<commit_msg>[#415] invalid issuances don't exists..<commit_after>ko.validation.rules['assetNameIsTaken'] = {
  async: true,
  message: 'Token name is already taken',
  validator: function (val, self, callback) {
    failoverAPI("get_issuances",
      {'filters': {'field': 'asset', 'op': '==', 'value': val}, 'status': 'valid'},
      function(data, endpoint) {
        return data.length ? callback(false) : callback(true) //empty list -> true (valid = true)
      }
    );   
  }
};
// TODO: DRY!!
ko.validation.rules['assetNameExists'] = {
  async: true,
  message: 'Token name does not exist',
  validator: function (val, self, callback) {
    failoverAPI("get_issuances", {'filters': {'field': 'asset', 'op': '==', 'value': val}, 'status': 'valid'},
      function(data, endpoint) {
        $.jqlog.debug("Asset exists: " + data.length);
        return data.length ? callback(true) : callback(false) //empty list -> false (valid = false)
      }
    );   
  }
};
ko.validation.rules['isValidAssetNameLength'] = {
    validator: function (val, self) {
      //Check length
      var n = 0;
      for(var i=0; i < val.length; i++) {
        n *= 26;
{'fraction_non_alphanumeric': 0.18411552346570398, 'fraction_numerical': 0.004963898916967509, 'mean_word_length': 3.0979667282809613, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1064962', 'n_tokens_mistral': 721, 'n_tokens_neox': 709, 'n_words': 179}