<commit_before>// The following has to be added to the bottom of typings/global/backbone.localstorage/index.d.ts.
// TODO: Figure out how to avoid this or add a pull request fixing this.
// declare module "backbone.localstorage" {
//     export = Backbone.LocalStorage;
// }
import Filter from "./Filter"
import Store = require("backbone.localstorage")
import TodoCollection from "./TodoCollection"

export default class RootModel extends Backbone.Model {
  defaults() {
    return {
      todos: TodoCollection,
      todosFilter: Filter.All
    }
  }

  localStorage = new Store("todos-typescript-marionette-v2")

  get filter(): Filter {
    return this.get("filter")
  }

  set filter(filter: Filter) {
    this.set("fitler", filter)
  }

  // TODO: Filtering a collection does not return a new collection, but an array.
  // get filteredTodos(): TodoCollection {
  //   const filtered = this.todos.filter(todo =>  {
  //     switch (this.filter) {
  //       case Filter.Active:
  //         return !todo.completed

  //       case Filter.All:
  //         return true

  //       case Filter.Completed:
  //         return todo.completed

  //       default:
  //         throw Error("Unknown filter state.")
  //     }
  //   })

  //   return filtered
  // }

  get todos(): TodoCollection {
    return this.get("todos")
  }

  set todos(todos: TodoCollection) {
    this.set("todos", todos)
  }
}
<commit_msg>Remove filter since it returns an array<commit_after>// The following has to be added to the bottom of typings/global/backbone.localstorage/index.d.ts.
// TODO: Figure out how to avoid this or add a pull request fixing this.
// declare module "backbone.localstorage" {
//     export = Backbone.LocalStorage;
// }
import Filter from "./Filter"
import Store = require("backbone.localstorage")
import TodoCollection from "./TodoCollection"

export default class RootModel extends Backbone.Model {
  defaults() {
    return {
      todos: TodoCollection,
      todosFilter: Filter.All
    }
  }

  localStorage = new Store("todos-typescript-marionette-v2")

  get filter(): Filter {
    return this.get("filter")
  }

  set filter(filter: Filter) {
    this.set("fitler", filter)
  }

  get todos(): TodoCollection {
    return this.get("todos")
  }

  set todos(todos: TodoCollection) {
    this.set("todos", todos)
  }
}

{'fraction_non_alphanumeric': 0.1210954214805306, 'fraction_numerical': 0.0008557980316645272, 'mean_word_length': 2.7408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1678248', 'n_tokens_mistral': 724, 'n_tokens_neox': 714, 'n_words': 200}