Socket
Socket
Sign inDemoInstall

array-differ

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-differ

Create an array with values that are present in the first input array but not additional ones


Version published
Maintainers
1
Install size
2.34 kB
Created

Package description

What is array-differ?

The array-differ npm package is a simple utility that allows you to find the difference between two arrays, essentially returning elements that are present in the first array but not in the second. It is useful for filtering out unwanted elements when comparing lists.

What are array-differ's main functionalities?

Array Difference

This code sample demonstrates how to use array-differ to find the difference between two arrays. It filters out elements from the first array that are not present in the second array, returning [1] in this case.

[1, 2, 3].filter(element => !['2', '3', '4'].includes(element))

Other packages similar to array-differ

Readme

Source

array-differ Build Status

Create an array with values that are present in the first input array but not additional ones

Install

$ npm install --save array-differ

Usage

var arrayDiffer = require('array-differ');

arrayDiffer([2, 3, 4], [3, 50]);
//=> [2, 4]

API

arrayDiffer(input, values, [values, ...])

Returns the new array.

input

Type: array

values

Type: array

Arrays of values to exclude.

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 13 Aug 2014

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