Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fork,
debounce,
filter,
forEach,
} from 'overmind'
import { Todo } from './state'
type ChangeEvent = React.ChangeEvent
let nextTodoId = 0
export const changeNewTodoTitle: Operator = pipe(
map(({ value }) => value.target.value),
mutate(({ state, value }) => (state.newTodoTitle = value)),
map(() => ['foo', 'bar', 'baz']),
forEach(run(() => {})),
filter(() => true),
debounce(200)
)
/*
export const changeNewTodoTitle: Action = ({
value: event,
state,
}) => {
state.newTodoTitle = event.target.value
}
*/
export const addTodo: Action = ({ state }) => {
state.todos.unshift({
id: String(nextTodoId++),