You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Polymorphic updating or inserting in one operation. We're using ad hoc polymorphism here.
Describe the solution you'd like
// working on objectsupsert('key',()=>'new value',()=>'initial value',{});// {key: 'initial value'}upsert('key',()=>'new value',()=>'initial value',{key: 'value'});// {key: 'new value'}// working on arraysupsert(1,()=>'new value',()=>'initial value',[]);// sparse array of [, 'initial value']upsert(1,()=>'new value',()=>'initial value',['first value','second vaue']);// ['first value', 'new value']// working on mapsupsert('key',()=>'new value',()=>'initial value',newMap());// Map({key: 'initial value'})upsert('key',()=>'new value',()=>'initial value',newMap([['key','new value']]));// Map({key: 'new value'})
Describe alternatives you've considered
--
Additional context
TC39 Map.upsert proposal: https://github.com/tc39/proposal-upsert (stage 2 proposal). Our version of polymorhic upsert can work on multiple JavaScript types.
The text was updated successfully, but these errors were encountered:
We discussed the viability of this function with TC39 proposal author and he agrees the function make sense if the library (R, RA) already support polymorphic functions.
Is your feature request related to a problem? Please describe.
Polymorphic updating or inserting in one operation. We're using ad hoc polymorphism here.
Describe the solution you'd like
Describe alternatives you've considered
--
Additional context
TC39 Map.upsert proposal: https://github.com/tc39/proposal-upsert (stage 2 proposal). Our version of polymorhic upsert can work on multiple JavaScript types.
The text was updated successfully, but these errors were encountered: