Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/array-duplicated
Return an array of duplicated values in a given array
https://github.com/shinnn/array-duplicated
Last synced: 27 days ago
JSON representation
Return an array of duplicated values in a given array
- Host: GitHub
- URL: https://github.com/shinnn/array-duplicated
- Owner: shinnn
- License: isc
- Created: 2014-11-17T07:21:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-12-14T01:54:44.000Z (almost 6 years ago)
- Last Synced: 2024-09-18T02:05:44.975Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://npm.runkit.com/array-duplicated
- Size: 79.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# array-duplicated
[![npm version](https://img.shields.io/npm/v/array-duplicated.svg)](https://www.npmjs.com/package/array-duplicated)
[![Build Status](https://travis-ci.com/shinnn/array-duplicated.svg?branch=master)](https://travis-ci.com/shinnn/array-duplicated)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/array-duplicated.svg)](https://coveralls.io/github/shinnn/array-duplicated)Return duplicated values in a given `Array`
```javascript
arrayDuplicated(['a', 2, 'b', true, 'b', 12, 'b', true, ['a']]) //=> ['b', true];
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```
npm install array-duplicated
```## API
```javascript
import arrayDuplicated from 'array-duplicated';
```### arrayDuplicated(*array*)
*array*: `Array`
Return: `Array`It finds duplicated values in the `Array` and returns an `Array` of them.
```javascript
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](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value_equality) level.
```javascript
arrayDuplicated([-0, 0]); //=> []
```## License
[ISC License](./LICENSE) © 2017 - 2018 Shinnosuke Watanabe