<commit_before>'use strict';

const mongoose = require('mongoose');
const debug    = require('debug')('fm:Article');

const articleSchema = new mongoose.Schema({
  title:            { type: String, required: true, unique: true, }, 
  content:          { type: String, required: true, },
  subtitle:         { type: String, },
  publication_date: { type: Date, set: handlePublicationDate, }, 
});



/**
 * handlePublicationDate - Setter function for publication dates 
 *  
 * @param  {type} value description 
 * @return {type}       description 
 */ 
function handlePublicationDate(value) {
  console.log(value ? 'date value existed: ${value}' : 'date value was null');
  return value ? new Date(value) : null; 
}

// If no publication date, then article isn't published 
articleSchema.virtual('published')
  .get(function() {
    return this.publication_date ? true : false; 
  });

module.exports = mongoose.model('Article', articleSchema);
<commit_msg>fixed useless console log for publication date Article schema method<commit_after>'use strict';

const mongoose = require('mongoose');
const debug    = require('debug')('fm:Article');

const articleSchema = new mongoose.Schema({
  title:            { type: String, required: true, unique: true, }, 
  content:          { type: String, required: true, },
  subtitle:         { type: String, },
  publication_date: { type: Date, set: handlePublicationDate, }, 
});



/**
 * handlePublicationDate - Setter function for publication dates 
 *  
 * @param  {type} value description 
 * @return {type}       description 
 */ 
function handlePublicationDate(value) {
  console.log(value ? `date value existed: ${value}` : 'date value was null');
  return value ? new Date(value) : null; 
}

// If no publication date, then article isn't published 
articleSchema.virtual('published')
  .get(function() {
    return this.publication_date ? true : false; 
  });

module.exports = mongoose.model('Article', articleSchema);

{'fraction_non_alphanumeric': 0.13306246825799897, 'fraction_numerical': 0.0, 'mean_word_length': 3.758454106280193, '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': '1203034', 'n_tokens_mistral': 570, 'n_tokens_neox': 560, 'n_words': 165}