We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to see set of methods for bulk work with arrays items. They might be built on top of existing ones (e.g. set, merge, toggle, etc).
set
merge
toggle
Example of verbose code:
const units = state.units.map(unit => { if (unit.team === team) { return ({ ...unit, selected: true }); } else { return unit; } }); state = { ...state, units };
we can invent something like:
state = dotProps.mergeForArrayItems(state, 'units', { selected: true }, unit => unit.team === team);
or using dedicated namespace
state = dotProps.array.merge(state, 'units', { selected: true }, unit => unit.team === team); // signature: merge(obj, prop, val [, predicate])
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Feature request
I would like to see set of methods for bulk work with arrays items. They might be built on top of existing ones (e.g.
set
,merge
,toggle
, etc).Example of verbose code:
we can invent something like:
or using dedicated namespace
The text was updated successfully, but these errors were encountered: