3 ms·
Those helpers are basically the equivalent of seamless-immutable, which uses native JS objects but updates them by copying. You make the exact same tradeoffs as
by jlongster 11y ago
Those helpers are basically the equivalent of seamless-immutable, which uses native JS objects but updates them by copying. You make the exact same tradeoffs as if you chose it over Immutable.js. Comparing those two libs represents the choice of either persistent data structures or copying JS ones.
(Note that seamless-immutable also enforces immutability by using `Object.freeze` in development)
- jasim 11y agoThanks for the helpful reply, much appreciated.
- baddox 11y agoIt's worth mentioning that the ES6 array spread operator provides similar functionality: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator#A_more_powerful_array_literal https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... The object spread operator (proposed in ES7) is essentially syntactic sugar for Object.assign: https://github.com/sebmarkbage/ecmascript-rest-spread https://github.com/sebmarkbage/ecmascript-rest-spread https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... I've even used jQuery's extend in legacy projects: https://api.jquery.com/jquery.extend/ https://api.jquery.com/jquery.extend/