updateChoice = function (choice) {
                    if (deselectAll) {
                        _this._store.dispatch(removeItem$1(choice));
                    }
                    else if (existingItems[choice.value]) {
                        choice.selected = true;
                    }
                }
Set choices of select input via an array of objects (or function that returns array of object or promise of it),
a value field name and a label field name.
This behaves the same as passing items via the choices option but can be called after initialising Choices.
This can also be used to add groups of choices (see example 2); Optionally pass a true `replaceChoices` value to remove any existing choices.
Optionally pass a `customProperties` object to add additional data to your choices (useful when searching/filtering etc).

**Input types affected:** select-one, select-multiple

@example
```js
const example = new Choices(element);

example.setChoices([
  {value: 'One', label: 'Label One', disabled: true},
  {value: 'Two', label: 'Label Two', selected: true},
  {value: 'Three', label: 'Label Three'},
], 'value', 'label', false);
```

@example
```js
const example = new Choices(element);

example.setChoices(async () => {
  try {
     const items = await fetch('/items');
     return items.json()
  } catch(err) {
     console.error(err)
  }
});
```

@example
```js
const example = new Choices(element);

example.setChoices([{
  label: 'Group one',
  id: 1,
  disabled: false,
  choices: [
    {value: 'Child One', label: 'Child One', selected: true},
    {value: 'Child Two', label: 'Child Two',  disabled: true},
    {value: 'Child Three', label: 'Child Three'},
  ]
},
{
  label: 'Group two',
  id: 2,
  disabled: false,
  choices: [
    {value: 'Child Four', label: 'Child Four', disabled: true},
    {value: 'Child Five', label: 'Child Five'},
    {value: 'Child Six', label: 'Child Six', customProperties: {
      description: 'Custom description about child six',
      random: 'Another random custom property'
    }},
  ]
}], 'value', 'label', false);
```