_.chain(value)
Creates a lodash
wrapper instance that wraps value
with explicit method chain sequences enabled. The result of such sequences must be unwrapped with _#value
.
Since
1.3.0
Arguments
-
value
(*): The value to wrap.
Returns
(Object): Returns the new lodash
wrapper instance.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | var users = [ { 'user' : 'barney' , 'age' : 36 }, { 'user' : 'fred' , 'age' : 40 }, { 'user' : 'pebbles' , 'age' : 1 } ]; var youngest = _ .chain(users) .sortBy( 'age' ) .map( function (o) { return o.user + ' is ' + o.age; }) .head() .value(); // => 'pebbles is 1' |
Please login to continue.