Last active
May 24, 2021 18:19
-
-
Save RodrigoNovais/80ea03f51a65bf734a981a1209c3ed2d to your computer and use it in GitHub Desktop.
Returns the values from array that are not present in the other arrays
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
/** | |
* Returns the values from array that are not present in the other arrays | |
* | |
* @param {unknown[]} first | |
* @param {unknown[]} second | |
* @returns {unknown[]} | |
*/ | |
export const difference = (first: unknown[], second: unknown[]): unknown[] => { | |
return first.filter(item => !second.includes(item)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment