Socket
Socket
Sign inDemoInstall

array-unique

Package Overview
Dependencies
0
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-unique

Remove duplicate values from an array. Fastest ES5 implementation.


Version published
Weekly downloads
15M
increased by3.41%
Maintainers
2
Install size
7.80 kB
Created
Weekly downloads
 

Package description

What is array-unique?

The array-unique npm package is a small utility that removes duplicate values from an array. It is useful when you need to ensure that an array contains only unique items without having to write custom deduplication logic.

What are array-unique's main functionalities?

Deduplicate an array

This feature allows you to remove duplicate values from an array, resulting in an array of only unique items. The `arrayUnique` function is used as a callback for the `filter` method.

[1, 2, 2, 3, 4, 4, 5, 5].filter(arrayUnique)

Other packages similar to array-unique

Readme

Source

array-unique NPM version NPM downloads Build Status

Remove duplicate values from an array. Fastest ES5 implementation.

Install

Install with npm:

$ npm install --save array-unique

Usage

var unique = require('array-unique');

var arr = ['a', 'b', 'c', 'c'];
console.log(unique(arr)) //=> ['a', 'b', 'c']
console.log(arr)         //=> ['a', 'b', 'c']

/* The above modifies the input array. To prevent that at a slight performance cost: */
var unique = require("array-unique").immutable;

var arr = ['a', 'b', 'c', 'c'];
console.log(unique(arr)) //=> ['a', 'b', 'c']
console.log(arr)         //=> ['a', 'b', 'c', 'c']

About

  • arr-diff: Returns an array with only the unique values from the first array, by excluding all… more | homepage
  • arr-flatten: Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | homepage
  • arr-map: Faster, node.js focused alternative to JavaScript's native array map. | homepage
  • arr-pluck: Retrieves the value of a specified property from all elements in the collection. | homepage
  • arr-reduce: Fast array reduce that also loops over sparse elements. | homepage
  • arr-union: Combines a list of arrays, returning a single array with unique values, using strict equality… more | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.28, on July 31, 2016.

Keywords

FAQs

Last updated on 01 Aug 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc