How to use the dot-prop-immutable.merge function in dot-prop-immutable

To help you get started, we’ve selected a few dot-prop-immutable 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 webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elementSettings / advanced / AdvancedSettings.js View on Github external
onSubmit: ({ element, updateElement, closeDialog }) => (formData: Object) => {
            // Get element settings plugins
            const plugins = getPlugins("pb-page-element-advanced-settings").filter(
                pl => pl.elementType === element.type
            );
            formData = plugins.reduce((formData, pl) => {
                if (pl.onSave) {
                    return pl.onSave(formData);
                }
                return formData;
            }, formData);

            updateElement({
                element: merge(element, "data", formData)
            });
            closeDialog();
        },
        onClose: ({ closeDialog }) => () => closeDialog()
github webiny / webiny-js / packages / webiny-app-cms / src / editor / plugins / elementSettings / advanced / AdvancedSettings.js View on Github external
onSubmit: ({ element, updateElement, closeDialog }) => (formData: Object) => {
            // Get element settings plugins
            const plugins = getPlugins("cms-element-advanced-settings").filter(
                pl => pl.element === element.type
            );
            formData = plugins.reduce((formData, pl) => {
                if (pl.onSave) {
                    return pl.onSave(formData);
                }
                return formData;
            }, formData);

            updateElement({
                element: merge(element, "data", formData)
            });
            closeDialog();
        },
        onClose: ({ closeDialog }) => () => closeDialog()
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elementSettings / components / PMSettings.js View on Github external
return (name: string, newValue: mixed, history = false) => {
            const propName = `${valueKey}.${name}`;

            if (name !== "advanced") {
                newValue = parseInt(newValue) || 0;
            }

            let newElement = set(element, propName, newValue);

            // Update all values in advanced settings
            if (propName.endsWith(".all")) {
                const prefix = propName.includes("desktop") ? "desktop" : "mobile";
                newElement = merge(newElement, `${valueKey}.${prefix}`, {
                    top: newValue,
                    right: newValue,
                    bottom: newValue,
                    left: newValue
                });
            }

            updateElement({
                element: newElement,
                history,
                merge: true
            });
        };
    });
github spaceuptech / automate-redux / index.js View on Github external
case "RESET":
        // Reset the entire state
        if (action.path === undefined) {
          return initialState;
        }

        // Reset specific state
        return dotProp.set(
          state,
          action.path,
          dotProp.get(initialState, action.path)
        );

      case "PUSH":
        return dotProp.merge(state, action.path, [action.value]);

      case "INCREMENT":
        var initialValue = Number(dotProp.get(state, action.path, 0))
        var newValue = initialValue + action.value
        return dotProp.set(state, action.path, newValue)

      case "DECREMENT":
          var initialValue = Number(dotProp.get(state, action.path, 0))
          var newValue = initialValue - action.value
          return dotProp.set(state, action.path, newValue)

      case "DELETE":
        return dotProp.delete(state, action.path);

      default:
        return state;
github webiny / webiny-js / packages / webiny-app-cms / src / editor / plugins / elementSettings / components / PMSettings.js View on Github external
return (name: string, newValue: mixed, history = false) => {
                const propName = `${valueKey}.${name}`;

                if (name !== "advanced") {
                    newValue = parseInt(newValue) || 0;
                }

                let newElement = set(element, propName, newValue);

                // Update all values in advanced settings
                if (propName.endsWith(".all")) {
                    const prefix = propName.includes("desktop") ? "desktop" : "mobile";
                    newElement = merge(newElement, `${valueKey}.${prefix}`, {
                        top: newValue,
                        right: newValue,
                        bottom: newValue,
                        left: newValue
                    });
                }

                if (!history) {
                    updateElement({
                        element: newElement,
                        history
                    });
                    return;
                }

                if (historyUpdated[propName] !== newValue) {
github webiny / webiny-js / packages / webiny-app-cms / src / editor / plugins / elementSettings / link / LinkSettings.js View on Github external
updateSettings = data => {
        const { element, updateElement } = this.props;
        const attrKey = `data.link`;

        const newElement = merge(element, attrKey, data);

        updateElement({ element: newElement });

        if (!isEqual(this.historyUpdated, data)) {
            this.historyUpdated = data;
            updateElement({ element: newElement });
        }
    };
github ealgis / ealgis / frontend / src / redux / modules / layerform.tsx View on Github external
export const reduxFormReducer = (state: {}, action: any) => {
    switch (action.type) {
        case VALIDATION_ERRORS:
            state = dotProp.set(state, "submitSucceeded", false)
            return dotProp.merge(state, "syncErrors", action.errors)
        default:
            return state
    }
}
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elementSettings / link / LinkSettings.js View on Github external
updateSettings = data => {
        const { element, updateElement } = this.props;
        const attrKey = `data.link`;

        const newElement = merge(element, attrKey, data);

        updateElement({ element: newElement });

        if (!isEqual(this.historyUpdated, data)) {
            this.historyUpdated = data;
            updateElement({ element: newElement });
        }
    };
github ealgis / ealgis / frontend / src / reducers / index.tsx View on Github external
layerForm: (state: {}, action: any) => {
        switch(action.type) {
            case RECEIVE_LAYERFORM_ERRORS:
                state = dotProp.set(state, "submitSucceeded", false)
                return dotProp.merge(state, "syncErrors", action.errors)
            default:
                return state
        }
    }
})
github celo-org / celo-monorepo / packages / mobile / src / invite / reducer.ts View on Github external
...getRehydratePayload(action, 'invite'),
        isSendingInvite: false,
      }
    }
    case Actions.SEND_INVITE:
      return {
        ...state,
        isSendingInvite: true,
      }
    case Actions.SEND_INVITE_FAILURE:
      return {
        ...state,
        isSendingInvite: false,
      }
    case Actions.STORE_INVITEE_DATA:
      return dotProp.merge(state, 'invitees', { [action.address]: action.e164Number })
    case Actions.REDEEM_INVITE:
      return {
        ...state,
        redeemedInviteCode: action.inviteCode,
        isRedeemingInvite: true,
      }
    case Actions.REDEEM_INVITE_SUCCESS:
      return {
        ...state,
        redeemComplete: true,
        isRedeemingInvite: false,
      }
    case Actions.REDEEM_INVITE_FAILURE:
      return {
        ...state,
        redeemComplete: false,

dot-prop-immutable

Immutable version of dot-prop with some extensions

MIT
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis