aboutsummaryrefslogtreecommitdiff
path: root/src/background/domains/Completions.js
blob: 4e4219f4fadc5a522933b59bc3ebffbd0e4bae8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export default class Completions {
  constructor(groups) {
    this.g = groups;
  }

  get groups() {
    return this.g;
  }

  serialize() {
    return this.groups.map(group => ({
      name: group.name,
      items: group.items.map(item => ({
        caption: item.caption,
        content: item.content,
        url: item.url,
        icon: item.icon,
      })),
    }));
  }

  static EMPTY_COMPLETIONS = new Completions([]);

  static empty() {
    return Completions.EMPTY_COMPLETIONS;
  }
}