5 ms·
Show HN: Essential functions in JavaScript in vanilla form (inspired by PHP)
- onion2k 9y agoJavascript 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 9y agoThe 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 9y agoWhy 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?
- drivingmenuts 9y agoWell, there's always this: http://locutus.io/php/ http://locutus.io/php/ PHP functions written in Javascript. Been around for quite a while, actually.