2 ms·
I think the emphasis is in 'indiscriminatly'. The goal is not to have absolutely zero dependencies, just don't depend on dependencies that you could reasonably
by DocTomoe 1y ago
I think the emphasis is in 'indiscriminatly'. The goal is not to have absolutely zero dependencies, just don't depend on dependencies that you could reasonably implement yourself.
A classical example might be https://www.npmjs.com/package/is-odd https://www.npmjs.com/package/is-odd
- Phemist 1y agoJavaScript's weak typing and implicit type conversions get in the way of reasonability though: >>> '13' % 2 0 >>> 'nan' % 2 NaN >>> NaN % 2 NaN >>> null % 2 0 this package ensures that you have a sane complement to is-odd, e.g. `!isOdd(someVar)` is always even (in the domain of natural numbers). A naive implementation of is-odd: `(some_var % 2 === 1)`, does not have a sane complement. Anyway, to include this package as a dependency is indeed overkill. I would most likely opt for vendoring this package into the project (including licenses and acknowledgement), as the code is unlikely to change and is MIT licensed.
- johannes1234321 1y agoThe question is: how likely is it that I get the trash input in and do I care about the result if the input is trash? Modulo two works well for a lot of cases where this is needed. (Which probably is size of a container (array) or alternating something in a loop.