Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const clearError = set('error', defaultState.error)
export const errorReducer = (state, payload) => {
if (payload.error && payload.value) {
return setValue(applyError(state, payload.error), payload.value)
}
return applyError(state, payload)
}
export const dragEnterReducer = flow(
setFocus,
update('dragCount', add(1)),
)
export const dragLeaveReducer = flow(
update('dragCount', subtrahend(1)),
overBranch(flow(getDragCount, gte(0)), blurReducer),
)
// Can not overwrite value.
export const openReducer = (state, payload = {}) => ({
...state,
focus: true,
id: defaultTo(defaultTo(null, state.id), payload.id),
initialValue: defaultTo(
defaultTo(defaultTo(null, state.value), state.initialValue),
payload.initialValue,
),
isTouched: true,
value: defaultTo(defaultTo(null, payload.initialValue), state.value),
})