This code is from a project make maybe from JAVA developers that come to JS or for JS Jr developer. the if nesting I think is very bad. So for this reason I'm looking for alternatives to avoid write this type of code and publish material to try the developers in find new alternatives
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
well bad luck, thanks for your opinion. I consider more horrible a code like this:
export const removeProps = (source: Object, props: Array, keepReceivedProps: boolean = true) => {
return Object.keys(source).forEach(key => {
if (keepReceivedProps) {
if (!props.find(item => item == key)) delete source[key];
} else {
if (props.find(item => item == key)) delete source[key];
}
});
};
This code is from a project make maybe from JAVA developers that come to JS or for JS Jr developer. the if nesting I think is very bad. So for this reason I'm looking for alternatives to avoid write this type of code and publish material to try the developers in find new alternatives