I have an object that looks like
var foundUser = {
charData: []
}
which then I load an object from a database using mysql and then I ca
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