Skip to content

intersects

Determine if two arrays have a common item

154 bytes

Usage

Given two arrays of items, returns true if any item exists in both arrays.

import * as _ from 'radashi'
const oceanFish = ['tuna', 'tarpon']
const lakeFish = ['bass', 'trout']
_.intersects(oceanFish, lakeFish) // => false
const brackishFish = ['tarpon', 'snook']
_.intersects(oceanFish, brackishFish) // => true