Skip to content

Instantly share code, notes, and snippets.

@Dartv
Created September 22, 2015 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dartv/7c328bc19144d98b6d58 to your computer and use it in GitHub Desktop.
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
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