Skip to main content
Module

x/arrays/mod.ts>Arrays.common

Provides utility methods for common Array operations
Latest
function Arrays.common
import { Arrays } from "https://deno.land/x/arrays@v1.0.21/mod.ts";
const { common } = Arrays;

Returns the common values from all the given arrays.

import 'https://deno.land/x/arrays/mod.ts'

const arr1 = [1, 2, 3, 4]
const arr2 = [2, 'cat']
const arr3 = [1.1, 2.2, 3]
const arr4 = [[ 'cheetah', 'rhino' ], 4]

const commonArr = arr1.common(arr2, arr3, arr4)
// => [2, 3, 4]

Parameters

array: Array<any>
  • Rest of the arrays
...args: Array<any>

Returns

Array<any>