Created
September 22, 2015 15:21
-
-
Save Dartv/7c328bc19144d98b6d58 to your computer and use it in GitHub Desktop.
Loop through array of keys and make an object with given values or null
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleQueries(queries, values) { | |
let obj = {}; | |
for (let i = 0; i < queries.length; i++) { | |
obj[queries[i]] = this[queries[i]]() ? values[i] : null; | |
} | |
let vals = _.values(obj).filter(x => x !== null); | |
return vals; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment