<commit_before>/**
 * `AmountEntry` is used to store the data for a single
 * event. An event can be a single expense, income amount,
 * or a total such as income for a month.
 *
 * Copyright 2015 <NAME>
 */

var Backbone = require('backbone'),
    MoneyStack = require('moneystack');

var AmountEntry = Backbone.Model.extend({
   defaults: {
      amount: new MoneyStack(),
      name: '',
      date: '',
      category: 'unknown'
   },

   initialize: function(){
      if (!(this.get('amount') instanceof MoneyStack)) {
         this.set('amount', new MoneyStack(this.get('amount')));
      }
   },

   getDateOfMonth: function () {
      return this.getMonth() + '/1';
   },

   getMonth: function () {
      var dateStr = this.get('date');

      // Custom handling for 'mm/dd'
      if (dateStr.match( /\d{1,2}\/\d{1,2}/i)) {
         return parseInt(dateStr.split('/')[0]);
      }

      return new Date(dateStr).getMonth() + 1;
   }
});

module.exports = AmountEntry;<commit_msg>Match entire string for mm/dd handing<commit_after>/**
 * `AmountEntry` is used to store the data for a single
 * event. An event can be a single expense, income amount,
 * or a total such as income for a month.
 *
 * Copyright 2015 <NAME>
 */

var Backbone = require('backbone'),
    MoneyStack = require('moneystack');

var AmountEntry = Backbone.Model.extend({
   defaults: {
      amount: new MoneyStack(),
      name: '',
      date: '',
      category: 'unknown'
   },

   initialize: function(){
      if (!(this.get('amount') instanceof MoneyStack)) {
         this.set('amount', new MoneyStack(this.get('amount')));
      }
   },

   getDateOfMonth: function () {
      return this.getMonth() + '/1';
   },

   getMonth: function () {
      var dateStr = this.get('date');

      // Custom handling for 'mm/dd'
      if (dateStr.match(/^\d{1,2}\/\d{1,2}$/i)) {
         return parseInt(dateStr.split('/')[0]);
      }

      return new Date(dateStr).getMonth() + 1;
   }
});

module.exports = AmountEntry;
{'fraction_non_alphanumeric': 0.16425361957064402, 'fraction_numerical': 0.010983524712930605, 'mean_word_length': 2.67032967032967, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2817132', 'n_tokens_mistral': 645, 'n_tokens_neox': 619, 'n_words': 169}