top | item 15292619

Show HN: Essential functions in JavaScript in vanilla form (inspired by PHP)

5 points| amitmerchant | 8 years ago |github.com

4 comments

order
[+] onion2k|8 years ago|reply
Javascript has array_map called Array.prototype.map(), it has an array_merge method called Array.prototype.concat(), array_reject can be achieved using Array.prototype.filter() and so on. These functions are a poor reimplementation of some native features.
[+] brudgers|8 years ago|reply
The implementation of the functions can be refactored to call the methods of Arrray.prototype and Javascript's prototypical inheritance means that the abstractions in the library will remain robust even if the refactoring were done during runtime.

The value of the library is improving the names of the abstractions over arrays in a way that may better express a particular programmer's thought process. Better expressing a particular programmer's thought process via abstraction is why we don't all write in machine code.

[+] krapp|8 years ago|reply
Why not actually push a .js file instead of just examples in a readme?

Or, I guess the modern method would be why not publish every line of every function as a separate NPM package?