prototype.chain
_.prototype.chain()
创建一个 lodash
封装器实例,并启用显式方法链序列。
¥Creates a lodash
wrapper instance with explicit method chain sequences enabled.
新增于
¥Since
0.1.0
返回
¥Returns
(对象):返回新 的 lodash
封装器实例。
¥(Object): Returns the new lodash
wrapper instance.
示例
¥Example
var users = [
{ 'user': 'barney', 'age': 36 },
{ 'user': 'fred', 'age': 40 }
];
// A sequence without explicit chaining.
_(users).head();
// => { 'user': 'barney', 'age': 36 }
// A sequence with explicit chaining.
_(users)
.chain()
.head()
.pick('user')
.value();
// => { 'user': 'barney' }