-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
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
Set and Get methods #8
Comments
Can you explain a bit more how you would expect this to work? |
Case in point we have a long standing issue to support immutablejs map as state for redux-persist. Rather than make a special case for To do this we would need get and set, e.g.: var get = require('iterall').get
var set = require('iterall').set
//...
state = state.set('fooReducer', 'bar')
var foo = state.get('fooReducer') Of course this assumes we treat all iterables as immutable which is a bit opinionated... I do not have an easy solution, but if get & set were part of the protocol I think redux-persist and likely many other projects would be eager to adopt. |
This example assumes And I'm still a bit confused. I'm not sure I understand how you're thinking get and set might be implemented or how they should behave for any given Iterable. Consider: function* infiniteBlue() {
while (true) {
yield "blue";
}
}
var iterable = infiniteBlue();
// get?
// set? What would get and set do with this? What would be the API you imagine and what behavior would you expect? |
Ah sorry, in my example I meant for it to be Nevertheless, your point is taken that not all iterables have a concept of "keys". |
Libraries that work with iterables often need to get or set values by key or index. Would it make sense for iterall to support get & set?
The text was updated successfully, but these errors were encountered: