Lodash 应该算是目前在 npm 上被依赖的最多的包了吧，但是如果你使用 ES6，也许你不再需要它。在这篇文章中，我们将尝试使用一些 ES6 的新特性来解决几种常见的问题。
这些方法使转换数据变得轻而易举，而且非常通用。我们可以使用 ES6 的箭头函数语法，帮助我们用更简短的方式代替 Lodash 的语法。
如果你介意 reverse 改变了原来的数组，还可以使用另一个解构将原数组复制一份。
Without a higher level language such as TypeScript or Flow, we can’t give our functions type signatures which makes currying quite difficult. When we receive curried functions it’s hard to know how many arguments have already been supplied and which we will need to provide next. With arrow functions we can define curried functions explicitly, making them easier to understand for other programmers.
These explicitly curried arrow functions are particularly important for debugging.
Like with currying, we can use arrow functions to make partial application easy and explicit.
It’s also possible to use rest parameters with the spread operator to partially apply variadic functions.
Lodash comes with a number of functions that reimplement syntactical operators as functions, so that they can be passed to collection methods.
In most cases, arrow functions make them simple and short enough that we can define them inline instead.
Many of Lodash’s functions take paths as strings or arrays. We can use arrow functions to create more reusable paths instead.
Because these paths are “just functions”, we can compose them too.
We can even make higher order paths that accept parameters.
The pick utility allows us to select the properties we want from a target object. We can achieve the same results using destructuring and shorthand object literals.
Lodash provides some utilities for creating simple functions with a specific behaviour.
We can define all of these functions inline using arrows.
Or we could rewrite the example above as:
Lodash provides some functions for helping us write chained statements. In many cases the built-in collection methods return an array instance that can be directly chained, but in some cases where the method mutates the collection, this isn’t possible.
However, we can define the same transformations as an array of arrow functions.
Don’t disregard it, but instead—next time you reach for an abstraction—think about whether a simple function would do instead!