How to use the immutability-helper/index function in immutability-helper

To help you get started, we’ve selected a few immutability-helper 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 thinger-io / Mobile-App / src / reducers / lockedAttributes.js View on Github external
update.extend("$auto", function(value, object) {
    return object ? update(object, value) : update({}, value);
  });
  switch (action.type) {
github TheBrainFamily / TheBrain2.0 / web / src / scenes / Login / loginWrapper.js View on Github external
CurrentUser: (prev, {mutationResult}) => {
            return update(prev, {
              CurrentUser: {
                $set: mutationResult.data.logIn
              }
            })
          }
        }
github thinger-io / Mobile-App / src / reducers / lockedAttributes.js View on Github external
export default function lockedAttributes(
  state: LockedAttributesState = initialState,
  action: AttributeAction
) {
  update.extend("$auto", function(value, object) {
    return object ? update(object, value) : update({}, value);
  });
  switch (action.type) {
    case "ATTRIBUTE_LOCK":
      return update(state, {
        [action.chart]: { $auto: { [action.attribute]: { $set: true } } }
      });
    case "ATTRIBUTE_UNLOCK":
      return update(state, {
        [action.chart]: { $auto: { [action.attribute]: { $set: false } } }
      });
    case "ATTRIBUTE_REMOVE_ALL":
      return initialState;
    default:
      return state;
  }
}
github TheBrainFamily / TheBrain2.0 / web / src / scenes / Home / homeWrapper.js View on Github external
UserDetails: (prev, { mutationResult }) => {
            return update(prev, {
              UserDetails: {
                $set: mutationResult.data.selectCourse
              }
            })
          }
        }

immutability-helper

mutate a copy of data without changing the original source

MIT
Latest version published 4 years ago

Package Health Score

74 / 100
Full package analysis