2 ms·
Those infuriate me so much when I need a slight modification to the behavior of a third party library. Leaves no option but forking. There are such better ways
by apothegm 1y ago
Those infuriate me so much when I need a slight modification to the behavior of a third party library. Leaves no option but forking. There are such better ways to achieve encapsulation in modern JS.
- motorest 1y ago> There are such better ways to achieve encapsulation in modern JS. There aren't that many options even in modern JavaScript. You have ES6 modules, store state in a global map, what else?
- austin-cheney 1y agoIt's not so much about the encapsulation. Since ES6 you can achieve encapsulation more directly through an arbitrary block, such use of curly braces not associated with a loop, condition, or object. This is what older languages like C and SQL call a procedure. The primary value of IIFE is that it is encapsulation that outputs to a value and data type. For example if an IIFE returns a string then it looks like a function, behaves like a function, but it is a primitive string type.
- webstrand 1y agoYarn and pnpm have a `patch` utility and apply patches on install. It's how I fix pain points like this without a full on fork.