• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RisingStack / react-easy-state / 660

pending completion
660

Pull #418

circleci

GitHub
build(deps): bump json5 from 1.0.1 to 1.0.2 in /examples/pokedex
Pull Request #418: build(deps): bump json5 from 1.0.1 to 1.0.2 in /examples/pokedex

87 of 97 branches covered (89.69%)

Branch coverage included in aggregate %.

196 of 199 relevant lines covered (98.49%)

42.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/examples/todo-mvc/src/todosStore.js
1
import { store } from '@risingstack/react-easy-state';
2

3
// a complex global store with a lot of derived data (getters and setters)
4
// use 'todos' instead of 'this' in the store methods to make them passable as callbacks
5
const todos = store({
1✔
6
  all: [],
7
  filter: 'all',
8
  get isEmpty() {
9
    return todos.all.length === 0;
28✔
10
  },
11
  get completed() {
12
    return todos.all.filter(todo => todo.completed);
68✔
13
  },
14
  get hasCompleted() {
15
    return todos.completed.length !== 0;
28✔
16
  },
17
  get allCompleted() {
18
    return todos.all.every(todo => todo.completed);
40✔
19
  },
20
  set allCompleted(completed) {
21
    todos.all.forEach(todo => {
2✔
22
      todo.completed = completed;
4✔
23
    });
24
  },
25
  get active() {
26
    return todos.all.filter(todo => !todo.completed);
71✔
27
  },
28
  create(title) {
29
    todos.all.push({ title });
3✔
30
  },
31
  remove(id) {
32
    todos.all.splice(id, 1);
1✔
33
  },
34
  toggle(id) {
35
    const todo = todos.all[id];
3✔
36
    todo.completed = !todo.completed;
3✔
37
  },
38
  toggleAll() {
39
    todos.allCompleted = !todos.allCompleted;
2✔
40
  },
41
  clearCompleted() {
42
    todos.all = todos.active;
1✔
43
  },
44
});
45

46
export default todos;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc