Skip to content

Instantly share code, notes, and snippets.

@KamMif
Last active November 10, 2017 12:54
Show Gist options
  • Save KamMif/dbe38b59711e8efebfb23572d3b6cc0f to your computer and use it in GitHub Desktop.
Save KamMif/dbe38b59711e8efebfb23572d3b6cc0f to your computer and use it in GitHub Desktop.
find includes in array and output filtred object
const values = ['sadasdasd', 'sdfsdfsdf', 'sdfsdf'];
const obj = [{ id: 1, transaction: 'sadasdasd' }];
const sorted = obj.filter(item => item.transaction.indexOf(values.transaction) !== -1);
console.log(sorted);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment