News for hackers. Stuff that matters.
Re:Node_modules: One character saved 50 GB of disk space by samatman on Friday September 30, 2022 @07:37PM (#33042119)
It would appear this argument order is due to Principle 5: Data comes last, for consistent currying.

You might not like it, or the library (I don't write JS on purpose, so no opinion), but it's right there in the README.

Re:Node_modules: One character saved 50 GB of disk space by torgard on Saturday October 01, 2022 @08:40PM (#33051578)
I was not aware of the data-last convention. Thanks! Makes a lot of sense.

My mental model of assign was backwards, and it took me a while to comprehend why their implementation would be data-last.

So, the data is the object that is being modified? And the idea is it lets you write stuff like this more easily:

    const addStuffToObject = stuff -> object -> assign({ "some_stuff": stuff }, object);
    const addWeirdStuff = addStuffToObject("weird stuff");
    const weirdObj = addWeirdStuff({ "foo": "bar" });
Re:Node_modules: One character saved 50 GB of disk space by samatman on Sunday October 02, 2022 @07:22AM (#33054944)
Yes, and this sort of application (pun intended) is what the one-liner library is for.

If you have a function isEqualTo(a, b), you can curry(isEqualTo, 5) and filter with it.

`assign` could be used in the same way for assigning/overwriting the same field in an array of Objects, and so on.