<commit_before>import _ from 'lodash'

class Person {
  constructor() {
    this._courses = [];
  }
  get courses() {
    return this._courses;
  }

  set courses(courses) {
    this._courses = courses;
  }

  addCourse(course) {
    this._courses.push(course);
  }

  removeCourse(course) {
    return _.remove(this._courses, (val) => val === course);
  }

  removeAllCourses() {
    this._courses = [];
  }
}<commit_msg>repalce all operations to use add and remove funciton<commit_after>import _ from 'lodash'

class Person {
  constructor() {
    this._courses = [];
  }
  get courses() {
    return this._courses;
  }

  set courses(courses) {
    this.removeAllCourses();
    _.each(courses, (course) => {
      this.addCourse(course);
    });
  }

  addCourse(course) {
    this._courses.push(course);
  }

  removeCourse(course) {
    return _.remove(this._courses, (val) => val === course);
  }

  removeAllCourses() {
    this._courses = [];
  }
}
{'fraction_non_alphanumeric': 0.1506276150627615, 'fraction_numerical': 0.0, 'mean_word_length': 2.9382716049382718, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6254213', 'n_tokens_mistral': 347, 'n_tokens_neox': 330, 'n_words': 60}