map-transform-cjs
Version:
MapTransform with CJS support
19 lines (18 loc) • 548 B
JavaScript
// src/utils/stateHelpers.ts
var pushContext = (state, value) => ({
...state,
context: [...state.context, value]
});
var getTargetFromState = (state) => state.target;
var setStateValue = ({ untouched, ...state }, value, shouldPushContext = false) => shouldPushContext ? {
...pushContext(state, state.value),
value
} : { ...state, value };
// src/operations/plug.ts
function plug() {
return () => (_next) => async (state) => setStateValue(state, getTargetFromState(state));
}
export {
plug as default
};
//# sourceMappingURL=plug.js.map