4 ms·
Why not one package per line of code? One package per expression? Surely, someone will want to reuse var x = a + b. const {get} = require("underscore.get");
by weiming 8y ago
Why not one package per line of code? One package per expression? Surely, someone will want to reuse var x = a + b.
const {get} = require("underscore.get");
get(obj, 'a[0].b', defaultValue);
If your language requires this [1] just to be able to subscript things without going bonkers, it may be time for a new language.
[1] https://github.com/NarHakobyan/underscore.get https://github.com/NarHakobyan/underscore.get
- nailer 8y ago> Why not one package per line of code? Exactly. If it's a difficult line of code, with edge cases, requiring unit tests, etc. then sure. Algorithms are a great example of this. Using your own example: how many badly written copies of https://github.com/NarHakobyan/underscore.get/blob/master/underscore-get.js https://github.com/NarHakobyan/underscore.get/blob/master/un... do you want?