I know you asked for Underscore.js solutions, but you don’t need it for this. Here’s a oneliner using ES7 object spread operator and dynamic keys.
keys.reduce((obj, k, i) => ({...obj, [k]: values[i] }), {})
More Related Contents:
- Underscore template throwing variable not defined error
- Find by key deep in a nested array
- Explanation of …
- Add property to an array of objects
- How to use underscore.js as a template engine?
- One liner to flatten nested object
- Group objects by property in javascript
- Convert array of strings into an array of objects
- Loading Backbone and Underscore using RequireJS
- External template in Underscore
- Comparing two arrays of objects, and exclude the elements who match values into new array in JS
- How to use if statements in underscore.js templates?
- Underscore: sortBy() based on multiple attributes
- break array of objects into separate arrays based on a property
- What does _.debounce do?
- how to break the _.each function in underscore.js
- Recursive/deep extend/assign in Underscore.js?
- Group by multiple values Underscore.JS but keep the keys and values
- correctly implement backbone comparators
- Split JavaScript array in chunks using Lodash
- Sorting an Array of JavaScript Objects a Specific Order (using existing function)
- ESLint’s “no-undef” rule is calling my use of Underscore an undefined variable
- Return an object key only if value is true
- How can I do an asc and desc sort using underscore.js?
- Array Of JS Dates How To Group By Days
- obj.length === +obj.length in javascript
- underscore’s each checking for {} return of callback
- What is the difference between these Backbone/Underscore .bind() methods?
- Use underscore inside Angular controllers
- Remove duplicates in an object array Javascript