News for hackers. Stuff that matters.
Re:Just: A library of dependency-free JS utilities that do j... by _callcc on Saturday July 16, 2016 @07:05PM (#12108214)
`map` and `filter` should take their functional argument first, then data second.
Re:Just: A library of dependency-free JS utilities that do j... by krapp on Saturday July 16, 2016 @08:54PM (#12108499)
In a perfect world, map and filter would extend the Array prototype, which is how the language was designed to be extended.

That aside, to me, putting the data argument first would seem to make the code more readable.

Re:Just: A library of dependency-free JS utilities that do j... by madeofpalk on Saturday July 16, 2016 @11:48PM (#12108944)
map and filter are already builtins anyway, so it's kind of a moot point.

It sure is confusing why the author implemented these functions...

Re:Just: A library of dependency-free JS utilities that do j... by nilliams on Sunday July 17, 2016 @07:18PM (#12112378)
Cross-browser usage? Map and filter aren't in IE8, which is still in wider use than a lot of people would like to pretend.
Re:Just: A library of dependency-free JS utilities that do j... by madeofpalk on Monday July 18, 2016 @02:28AM (#12113505)
Well, what browsers you support is obviously going to depend strongly on your particular site and use case. I work on a consumer-facing site for a national broadcaster which sets very aggressive browser support (oldest IE we support is IE11) which works fine for us.

Regardless, any sort of environment where you can do `import extend from 'just-extend';` is going to (have a way) support map and filter.

Re:Just: A library of dependency-free JS utilities that do j... by nilliams on Monday July 18, 2016 @01:18PM (#12116494)
>> Regardless, any sort of environment where you can do `import extend from 'just-extend';` is going to (have a way) support map and filter.

That is not true for the now-fairly-common use case that browserify/webpack satisfy. I write code with ES6 module syntax and build with browserify (& babelify) to target the browser. But I still need to pull in modules like lodash.map/lodash.filter if I want to target IE8.

(I could use es5-shim but that makes for less portable code).

Re:Just: A library of dependency-free JS utilities that do j... by jestar_jokin on Saturday July 16, 2016 @09:32PM (#12108635)
Just use Ramda, it's a utility library that "gets the argument order correct", and supports currying and other nice FP concepts.

http://ramdajs.com/

http://fr.umio.us/why-ramda/

Re:Just: A library of dependency-free JS utilities that do j... by jdd on Sunday July 17, 2016 @06:43PM (#12112259)
Re:Just: A library of dependency-free JS utilities that do j... by vortico on Sunday July 17, 2016 @01:48AM (#12109164)
It makes it look nicer in Coffeescript to have the function last, but yes, I agree.
Re:Just: A library of dependency-free JS utilities that do j... by Kiro on Sunday July 17, 2016 @04:48AM (#12109503)
Why?
Re:Just: A library of dependency-free JS utilities that do j... by patricklynch on Monday July 18, 2016 @12:24PM (#12116047)
Because then you can curry/partially apply functions independent of your data.

It's _not_ because it's convention everywhere else.

(I realize that only really makes sense if you know why it makes sense, so this video gives a pretty good explanation in ~30 minutes - https://www.youtube.com/watch?v=m3svKOdZijA)

Re:Just: A library of dependency-free JS utilities that do j... by dozzie on Sunday July 17, 2016 @05:24AM (#12109545)
Because that's the convention everywhere else.
Re:Just: A library of dependency-free JS utilities that do j... by BillinghamJ on Sunday July 17, 2016 @07:31AM (#12109806)
Right, but that's not the convention in Node. Anonymous functions always go last.