aboutsummaryrefslogtreecommitdiff
path: root/src/content/actions/setting.js
blob: 353dd241beffff66e3cefd41938961b9720f9556 (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
import actions from 'content/actions';
import * as keyUtils from 'shared/utils/keys';

const set = (value) => {
  let maps = new Map();
  if (value.keymaps) {
    let entries = Object.entries(value.keymaps).map((entry) => {
      return [
        keyUtils.fromMapKeys(entry[0]),
        entry[1],
      ];
    });
    maps = new Map(entries);
  }

  return {
    type: actions.SETTING_SET,
    value: Object.assign({}, value, {
      keymaps: maps,
    })
  };
};

export { set };