Javascript code is quite verbose when compared to other langauges. One of the features I missed coming from the ruby world is lambdas and the &:
sugar.
1 2 3 |
|
compare this with javascript code
1
|
|
Good news is ES6 might come with proposed arrow functions, but it might take a while before all the browsers implement this. This is where f.js can be handy. This library will help to write redable code by writing less. You can write the above code as
1 2 3 |
|
f.js supports methods, negation and includes utilities like noop and identity. Examples
1 2 3 4 5 6 7 8 9 10 11 |
|
The f.y(lambda) method uses same syntax as arrow functions. Once ES6 arrow functions feature is available on all browsers, write a regex to remove usage of f.y and say bye to f.js
Code & Documentation: https://github.com/endeepak/f.js