mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-03 06:22:25 +02:00
18 lines
436 B
JavaScript
18 lines
436 B
JavaScript
import { sortByAlpha } from './../lib/utils.js';
|
|
|
|
const groups = (state = [], action) => {
|
|
switch (action.type) {
|
|
case 'ADD_GROUP':
|
|
return [...state, {
|
|
id: action.id,
|
|
value: action.value,
|
|
active: action.active,
|
|
disabled: action.disabled,
|
|
}].sort(sortByAlpha);;
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
}
|
|
|
|
export default groups; |