Comment

Comment by torgard

Someone linked me to 1-liners[0], which is - you guessed it - a bunch of one-liners. I think it's nice to have as a reference. But a dependency? Really?

My least favorite is assign.

Not only does JavaScript feature that natively (though I suppose the library may predate widespread support for Object.assign), the 1-liner assign flips the order of the parameters!

    assign({ a: true }, { a: false }) -> { a: true }
    Object.assign({ a: true }, { a: false }) -> { a: false }
And most of them are just straight-up pointless! Like, let's introduce a dependency for decrement lol

EDIT: In looking up whether the 1-liners assign predated widespread Object.assign support, I found that their implementation - confusingly named extend[1] at first - literally used Object.assign from the very beginning. And they still chose to mess with the parameter order. For shame lol

[0] https://github.com/1-liners/1-liners

[1] https://github.com/1-liners/1-liners/blob/7c1f8d51df4b4b3e0a...

parent torgard 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton