Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
unique-concat
Advanced tools
Concatenates two arrays, removing duplicates in the process and returns one array with unique values.
Concatenates two arrays, removing duplicates in the process and returns one array with unique values.
var concat = require('unique-concat');
var res = concat([ 1, 2, 3 ], [ 1, 2, 3, 4, 5, 6])
console.log(res);
// => [1, 2, 3, 4, 5, 6]
npm install unique-concat
###function uniqueConcat(arr1, arr2[, identity])
/**
* Concatenates two arrays, removing duplicates in the process and returns one array with unique values.
* In case the elements in the array don't have a proper built in way to determine their identity,
* a custom identity function must be provided.
*
* As an example, {Object}s all return '[ 'object' ]' when .toString()ed and therefore require a custom
* identity function.
*
* @name exports
* @function unique-concat
* @param arr1 {Array} first batch of elements
* @param arr2 {Array} second batch of elements
* @param identity {Function} (optional) supply an alternative way to get an element's identity
*/
var identity = function (obj) { return obj.a; }
var res = concat([{ a: 1 }, { a: 2, b: 1}], [{ a: 2, b: 2 }, { a: 3 }], identity);
console.log(res);
// => [ { a: 1 }, { a: 2, b: 2 }, { a: 3 } ]
For more examples see tests
MIT
FAQs
Concatenates two arrays, removing duplicates in the process and returns one array with unique values.
The npm package unique-concat receives a total of 47,454 weekly downloads. As such, unique-concat popularity was classified as popular.
We found that unique-concat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.