{"id":13446978,"url":"https://github.com/jonschlinkert/arr-diff","last_synced_at":"2025-04-05T12:07:45.191Z","repository":{"id":398971,"uuid":"24489135","full_name":"jonschlinkert/arr-diff","owner":"jonschlinkert","description":"Returns an array with only the unique values from all given arrays using strict equality for comparisons.","archived":false,"fork":false,"pushed_at":"2022-01-04T11:06:12.000Z","size":56,"stargazers_count":46,"open_issues_count":5,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T11:09:41.205Z","etag":null,"topics":["arr","array","diff","difference","elements","javascript","nodejs","unique","util","utility","values"],"latest_commit_sha":null,"homepage":"https://github.com/jonschlinkert","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-26T06:39:31.000Z","updated_at":"2024-11-01T23:12:21.000Z","dependencies_parsed_at":"2022-08-06T09:15:07.592Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/arr-diff","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Farr-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Farr-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Farr-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Farr-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/arr-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332609,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arr","array","diff","difference","elements","javascript","nodejs","unique","util","utility","values"],"created_at":"2024-07-31T05:01:04.712Z","updated_at":"2025-04-05T12:07:45.168Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","readme":"# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg?style=flat)](https://www.npmjs.com/package/arr-diff) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-diff.svg?style=flat)](https://npmjs.org/package/arr-diff) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-diff.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/arr-diff)\n\n\u003e Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save arr-diff\n```\n\nInstall with [yarn](https://yarnpkg.com):\n\n```sh\n$ yarn add arr-diff\n```\n\nInstall with [bower](https://bower.io/)\n\n```sh\n$ bower install arr-diff --save\n```\n\n## Usage\n\nReturns the difference between the first array and additional arrays.\n\n```js\nvar diff = require('arr-diff');\n\nvar a = ['a', 'b', 'c', 'd'];\nvar b = ['b', 'c'];\n\nconsole.log(diff(a, b))\n//=\u003e ['a', 'd']\n```\n\n## Benchmarks\n\nThis library versus [array-differ](https://github.com/sindresorhus/array-differ), on April 14, 2017:\n\n```\nBenchmarking: (4 of 4)\n · long-dupes\n · long\n · med\n · short\n\n# benchmark/fixtures/long-dupes.js (100804 bytes)\n  arr-diff-3.0.0 x 822 ops/sec ±0.67% (86 runs sampled)\n  arr-diff-4.0.0 x 2,141 ops/sec ±0.42% (89 runs sampled)\n  array-differ x 708 ops/sec ±0.70% (89 runs sampled)\n\n  fastest is arr-diff-4.0.0\n\n# benchmark/fixtures/long.js (94529 bytes)\n  arr-diff-3.0.0 x 882 ops/sec ±0.60% (87 runs sampled)\n  arr-diff-4.0.0 x 2,329 ops/sec ±0.97% (83 runs sampled)\n  array-differ x 769 ops/sec ±0.61% (90 runs sampled)\n\n  fastest is arr-diff-4.0.0\n\n# benchmark/fixtures/med.js (708 bytes)\n  arr-diff-3.0.0 x 856,150 ops/sec ±0.42% (89 runs sampled)\n  arr-diff-4.0.0 x 4,665,249 ops/sec ±1.06% (89 runs sampled)\n  array-differ x 653,888 ops/sec ±1.02% (86 runs sampled)\n\n  fastest is arr-diff-4.0.0\n\n# benchmark/fixtures/short.js (60 bytes)\n  arr-diff-3.0.0 x 3,078,467 ops/sec ±0.77% (93 runs sampled)\n  arr-diff-4.0.0 x 9,213,296 ops/sec ±0.65% (89 runs sampled)\n  array-differ x 1,337,051 ops/sec ±0.91% (92 runs sampled)\n\n  fastest is arr-diff-4.0.0\n```\n\n## About\n\n### Related projects\n\n* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten \"Recursively flatten an array or arrays. This is the fastest implementation of array flatten.\")\n* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter \"Array#filter for older browsers.\")\n* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://github.com/jonschlinkert/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection \"Return an array with the unique values present in _all_ given arrays using strict equality for comparisons.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 33 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 2 | [paulmillr](https://github.com/paulmillr) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 14, 2017._","funding_links":[],"categories":["JavaScript","Modules","模块"],"sub_categories":["Array","数组"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Farr-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Farr-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Farr-diff/lists"}