has-duplicates
v1.0.0
Published
Returns true if an array has duplicate elements or a string has duplicate characters.
Downloads
11,225
Readme
has-duplicates
A Node.js module that checks an array for duplicate elements or a string for duplicate characters.
Installation
npm install has-duplicates --save
Usage
const hasDuplicates = require('has-duplicates')
// Arrays
hasDuplicates([1, 1]) // true
hasDuplicates([1, 2]) // false
// Strings
hasDuplicates('aa') // true
hasDuplicates('ab') // false