<commit_before>var mongoose = require('mongoose');
var bcrypt = require('bcryptjs');

var Schema = mongoose.Schema;
var SALT_WORK_FACTOR;

if (process.env.NODE_ENV === 'test') {
  SALT_WORK_FACTOR = 1;
} else {
  SALT_WORK_FACTOR = 10;
}

var Merchant = new Schema({
  email: {
    type: String,
    unique: true,
    lowercase: true
  },
  products: [
    {
      productID: String,
      token: String,
      time: { type: Date, default: Date.now }
    }
  ],
  password: {
    type: String,
    required: true
  },
  admin: {
    type: Boolean,
    default: false
  },
  stripe: {
    type: String,
    unique: true,
    default: "NAN"
  }
});

Merchant.methods.generateHash = function(password, callback) {
  bcrypt.genSalt(10, function(err, salt) {
    if (err) {
      return next(err);
    }
    bcrypt.hash(password, salt, function(err, hash) {
      if (err) {
        return next(err);
      }
      return callback(err, hash);
    });
  });
};

Merchant.methods.comparePassword = function(password, done) {
  bcrypt.compare(password, this.password, function(err, isMatch) {
    if (err) {
      return done(err);
    }
    return done(null, isMatch);
  });
};


module.exports = mongoose.model('merchants', User);
<commit_msg>Fixed issue with Merchant model export.<commit_after>var mongoose = require('mongoose');
var bcrypt = require('bcryptjs');

var Schema = mongoose.Schema;
var SALT_WORK_FACTOR;

if (process.env.NODE_ENV === 'test') {
  SALT_WORK_FACTOR = 1;
} else {
  SALT_WORK_FACTOR = 10;
}

var Merchant = new Schema({
  email: {
    type: String,
    unique: true,
    lowercase: true
  },
  products: [
    {
      productID: String,
      token: String,
      time: { type: Date, default: Date.now }
    }
  ],
  password: {
    type: String,
    required: true
  },
  admin: {
    type: Boolean,
    default: false
  },
  stripe: {
    type: String,
    unique: true,
    default: "NAN"
  }
});

Merchant.methods.generateHash = function(password, callback) {
  bcrypt.genSalt(10, function(err, salt) {
    if (err) {
      return next(err);
    }
    bcrypt.hash(password, salt, function(err, hash) {
      if (err) {
        return next(err);
      }
      return callback(err, hash);
    });
  });
};

Merchant.methods.comparePassword = function(password, done) {
  bcrypt.compare(password, this.password, function(err, isMatch) {
    if (err) {
      return done(err);
    }
    return done(null, isMatch);
  });
};


module.exports = mongoose.model('merchants', Merchant);

{'fraction_non_alphanumeric': 0.14496805111821087, 'fraction_numerical': 0.003993610223642172, 'mean_word_length': 2.8127853881278537, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5370142', 'n_tokens_mistral': 888, 'n_tokens_neox': 877, 'n_words': 195}