0

New to underscore. Trying to clean up my code by chaining things together.

tried this but no success:

keys = _(arrayofobjects).first().keys()

Is this possible?

1
  • 1
    Have a look at the chain function Commented May 27, 2015 at 14:19

1 Answer 1

2

You need to use _.chain() and .value() to use the chaining functions:

keys = _.chain(arrayofobjects).first().keys().value()

See http://underscorejs.org/#chaining

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.