Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function updatedErrorState(initialState:IApplicationState, error:string, resetValue:string):IApplicationState{
const errors = (initialState.errors ? addError(initialState.errors, error) : [error]);
return objectAssign({}, initialState, {errors, [resetValue]:0});
}
function changeColor(initialState:IApplicationState, color:string){
return objectAssign({}, initialState, {"color":color});
}
function changeWidth(initialState:IApplicationState, width:any):IApplicationState {
if(isValidNumeric(width)){
return updatedErrorState(initialState, widthError, "width");
}
const errors = removeError(initialState.errors, widthError);
return objectAssign({}, initialState, {width,errors});
}
function changeHeight(initialState:IApplicationState, height:any):IApplicationState {
if(isValidNumeric(height)){
return updatedErrorState(initialState, heightError, "height");
}
const errors = removeError(initialState.errors, heightError);
return objectAssign({}, initialState, {height, errors});
}