Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

chain

v4.17.11arrow_drop_down
v4.17.11
STATUS
Passing
DOWNLOADS
8
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
8 months ago
SIZE
1 KB
Creates a `lodash` wrapper instance that wraps `value` with explicit method chain sequences enabled.
1 contributor
Use chain in your project ?
Copied
npm i @bit/lodash.lodash.chain
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
revert changes
reload
toggle layout
maximize
 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' 
 export default 
modifieddraft
chevron_left
chevron_right
chain (
value:*
) : Object

Creates a lodash wrapper instance that wraps value with explicit method chain sequences enabled. The result of such sequences must be unwrapped with _#value.

Example
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'
Argument
value: *

The value to wrap.

Returns
Object

Returns the new `lodash` wrapper instance.