New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

unique_values_from_two_arrays

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unique_values_from_two_arrays

It accespts two arrays and in response returns unique values from it

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

GetUniqueElementFromArray

Source code on npm module

About

It accepts two arrays no matter how much nested arrays or objects in it, it will return unique values from it

Installation

npm i unique_values_from_two_arrays --save

Then... Lets consider that we have two simple arrays

let getUniqueValuesFromTwoArrays = require("unique_values_from_two_arrays")
let x = ['a' , 'b' , 'c']
let y = ['b' , 'c' , 'd']
 getUniqueValuesFromTwoArrays(x,y)


//output

// [ 'a', 'd' ]

Then... Now lets say we have arrays with deeply nested arrays and objects in it

let x = ['a'  , 'c' , {x:"x" , y : "z"} , ['g' ,'h']]
let y = ['a' , 'b' , {x:"x" , y : "y"} , ['g' ,'h']]
getUniqueValuesFromTwoArrays(x,y)

//output [ { x: 'x', y: 'z' }, 'c', { x: 'x', y: 'y' }, 'b' ]

Keywords

Javascript

FAQs

Package last updated on 16 Feb 2020

Did you know?

Socket

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