How to use the understory.subtrahend function in understory

To help you get started, we’ve selected a few understory examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cape-io / redux-field / src / reducer.js View on Github external
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),
})

understory

Composable utility functions based on lodash fp.

ISC
Latest version published 1 year ago

Package Health Score

46 / 100
Full package analysis