# @writetome51/arrays-match

> Takes 2 arrays as arguments, and if they match, returns true

Latest version **2.0.3** (published 2021-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @writetome51/arrays-match
pnpm add @writetome51/arrays-match
yarn add @writetome51/arrays-match
bun add @writetome51/arrays-match
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2021-03-24 |
| First published | 2018-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Steve Thompson |
| Maintainers | writetome51 |
| Keywords | array, arrays, check, match, identical, comparison, function |

## Links

- npm: https://www.npmjs.com/package/@writetome51/arrays-match
- Repository: https://github.com/writetome51/arrays-match
- Homepage: https://github.com/writetome51/arrays-match#readme
- Issues: https://github.com/writetome51/arrays-match/issues
- npm.io page: https://npm.io/package/@writetome51/arrays-match

## Dependencies (4)

- [@arr/every](https://npm.io/package/@arr/every.md) ^1.0.1
- [error-if-values-are-not-arrays](https://npm.io/package/error-if-values-are-not-arrays.md) ^2.0.1
- [@writetome51/is-array-not-array](https://npm.io/package/@writetome51/is-array-not-array.md) ^2.0.0
- [@writetome51/is-empty-not-empty](https://npm.io/package/@writetome51/is-empty-not-empty.md) ^2.0.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.3 (latest) — 2021-03-24
- 2.0.2 — 2020-08-29
- 2.0.1 — 2020-08-12
- 2.0.0 — 2020-07-28
- 1.0.6 — 2019-04-10
- 1.0.5 — 2019-02-23
- 1.0.4 — 2018-11-27
- 1.0.3 — 2018-11-20
- 1.0.2 — 2018-10-21
- 1.0.1 — 2018-10-07
- 1.0.0 — 2018-09-26

## README

[![npm version](https://badge.fury.io/js/%40writetome51%2Farrays-match.svg)](https://badge.fury.io/js/%40writetome51%2Farrays-match) ![NpmLicense](https://img.shields.io/npm/l/%40writetome51%2Farrays-match.svg) ![npm](https://img.shields.io/npm/dw/%40writetome51%2Farrays-match.svg)

# arraysMatch(array1, array2): boolean

If `array1` and `array2` match, returns true.  
It automatically handles checking nested arrays. 

How the matching is done:  
If `(array1 === array2)`, returns true.  
Else, it tries element-by-element matching:  
if `array1[i] === array2[i]` for every `i` in `array1` and `array2`, it's a match.  
If `array1[i]` and `array2[i]` are both arrays of equal length, they're passed  
into a recursive function call.

## Examples
```js
arraysMatch([], []); // true

arraysMatch(['h', 'j'],  ['h', 'j']); // true

arraysMatch(['h', 'j'],  ['h', 'j', 'k']); // false

arraysMatch([1, 2, [3]], [1, 2, [3]]); // true

let obj = {prop: 1};
arraysMatch([obj], [{prop:1}]); // false

arraysMatch([obj], [obj]); // true

let obj2 = obj;
arraysMatch([obj], [obj2]); // true
```

## Installation
`npm i  @writetome51/arrays-match`


## Loading
```js
import {arraysMatch} from '@writetome51/arrays-match'; 
```

---
_Source: https://npm.io/package/@writetome51/arrays-match · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
