<commit_before>'use strict';

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const vendorSchema = new Schema({
  title: { type: String, required: true },
  url: { type: String, required: true },
  minOrderCost: { type: Number }
});

vendorSchema.path('title').validate(function(title, callback) {
  const Vendor = mongoose.model('Vendor');

  if (this.isNew || this.isModified('title')) {
    Vendor.find({ title }).exec((err, vendors) =>
      callback(!err && vendors.length === 0)
    );
  } else {
    callback(true);
  }
}, 'Food vendor already exists');

module.exports = mongoose.model('Vendor', vendorSchema);<commit_msg>Use dashed name for vendor schema attribute<commit_after>'use strict';

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const vendorSchema = new Schema({
  title: { type: String, required: true },
  url: { type: String, required: true },
  'min-order-cost': { type: Number }
});

vendorSchema.path('title').validate(function(title, callback) {
  const Vendor = mongoose.model('Vendor');

  if (this.isNew || this.isModified('title')) {
    Vendor.find({ title }).exec((err, vendors) =>
      callback(!err && vendors.length === 0)
    );
  } else {
    callback(true);
  }
}, 'Food vendor already exists');

module.exports = mongoose.model('Vendor', vendorSchema);
{'fraction_non_alphanumeric': 0.1701492537313433, 'fraction_numerical': 0.0014925373134328358, 'mean_word_length': 4.42914979757085, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1753261', 'n_tokens_mistral': 412, 'n_tokens_neox': 415, 'n_words': 103}