UNPKG

496 BJavaScriptView Raw
1/**
2 * returns true if there's at least one element in pLeftArray that's also in pRightArray
3 *
4 * @param {string[]} pLeftArray an array of strings
5 * @param {string[]} pRightArray another array of strings
6 * @return {boolean} true if there's at least one element in pLeftArray also in pRightArray
7 */
8function intersects(pLeftArray, pRightArray) {
9 return pLeftArray.some((pLeftItem) =>
10 pRightArray.some((pRightItem) => pLeftItem === pRightItem)
11 );
12}
13
14module.exports = {
15 intersects,
16};