How do you chain functions using lodash?

To chain with lodash, you first have to wrap the object:

_(foundUser).assignIn(rows[0]).omit(['blah']).value();

Further clarification:

The _ creates a lodash object which allows for implicit method chaining. Implicit method chaining means that in certain circumstances it may return a primitive value, in others it may return a lodash object that you need to unwrap by calling .value() on it.

If you’d use _.chain(...), you’d be creating a lodash object with explicit method chaining. The result is always a wrapped value and always needs to be unwrapped by calling .value() on it.

For further reference here are the links to the documentation:

Explicit chaining in Lodash

Implicit chaining in Lodash

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)