Skip to content

Instantly share code, notes, and snippets.

@santosh-rumsan
Last active November 6, 2019 09:38
Show Gist options
  • Save santosh-rumsan/cb9b4cc40a603a328108e2cba1728ab1 to your computer and use it in GitHub Desktop.
Save santosh-rumsan/cb9b4cc40a603a328108e2cba1728ab1 to your computer and use it in GitHub Desktop.
There are several cases where we need to check if every item of an particular exists within another array.
let queue = {
actions: ["email", "aws"],
results: [
{
success: false,
retryable: false,
action: "aws"
},
{
success: true,
retryable: false,
action: "email"
}
]
};
let resultsActions = queue.results.map(d => d.action);
console.log(
queue.actions.every(i => resultsActions.includes(i))
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment