array-duplicated

Return an Array of duplicated values in a given Array

Usage no npm install needed!

<script type="module">
  import arrayDuplicated from 'https://cdn.skypack.dev/array-duplicated';
</script>

README

array-duplicated

npm version Build Status Coverage Status

Return duplicated values in a given Array

arrayDuplicated(['a', 2, 'b', true, 'b', 12, 'b', true, ['a']]) //=> ['b', true];

Installation

Use npm.

npm install array-duplicated

API

import arrayDuplicated from 'array-duplicated';

arrayDuplicated(array)

array: Array<any>
Return: Array

It finds duplicated values in the Array and returns an Array of them.

arrayDuplicated([0, 1, 1, 1, 1, 1, 1, 1, 1, 1]); //=> [1]

"Duplicated" means a value is identical to another value in the ECMAScript same-value equality level.

arrayDuplicated([-1, 1]); //=> []

License

ISC License © 2017 - 2018 Shinnosuke Watanabe