Last active
November 6, 2019 09:38
-
-
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.
This file contains 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
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