rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.37k stars 194 forks source link

adding `withoutIn` for deep property removal #139

Closed y-nk closed 7 years ago

y-nk commented 8 years ago

I had this need to remove a property from a dictionary within my state.

with a state structure like :

{
   pool_of_items: {
     ...ids : Object
   },
   visible_items: {
      ...ids : occurence_number
   }
}

I can now call state.withoutIn(['visible_items'], item_id) to remove a key from my dictionary and keep it with a clean structure of item.id => number_of_occurence_on_screen.

I tried my best to keep the coding fashion you used. Let me know if you need any adjustment or if you feel there is an other way of doing this.

rtfeldman commented 7 years ago

This has been pending changes for about two months, so I'm going to close it as stale.

Please feel free to reopen with those changes! :)

AfrazHussain commented 4 years ago

Any chances of re-opening and merging this? I can contribute to another similar PR if necessary.

y-nk commented 4 years ago

I honestly forgot about this (since i was using my own fork at the time). I'll try again and put test coverage this time.