# find-neighbors-in-matrix

> Easy-to-use, typed, and tested utility to find the neighbors of a cell in a matrix.

Latest version **0.2.1** (published 2022-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install find-neighbors-in-matrix
pnpm add find-neighbors-in-matrix
yarn add find-neighbors-in-matrix
bun add find-neighbors-in-matrix
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2022-03-17 |
| First published | 2022-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14 |
| Dependencies | 0 |
| Unpacked size | 18.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | David Sorrentino |
| Maintainers | dapids |

## Links

- npm: https://www.npmjs.com/package/find-neighbors-in-matrix
- npm.io page: https://npm.io/package/find-neighbors-in-matrix

## Recent versions

- 0.2.1 (latest) — 2022-03-17
- 0.2.0 — 2022-03-17
- 0.1.1 — 2022-03-17
- 0.1.0 — 2022-03-17

## README

# Find-neighbors-in-matrix
Easy-to-use, typed, and tested utility to find the neighbors of a cell in a matrix.

![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=flat)
![Branches](https://img.shields.io/badge/branches-100%25-brightgreen.svg?style=flat)
![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat)
![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=flat)

## Install
```bash
yarn add -E find-neighbors-in-matrix # or npm install find-neighbors-in-matrix
```

## Use
```typescript
import { findNeighborsInMatrix } from 'find-neighbors-in-matrix'

const matrix = [
  [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1],
]

const cell = [0, 0] // x, y

const neighbors = findNeighborsInMatrix({ cell, matrix }) // [[1, 0], [1, 1], [0, 1]]
```

## Contribute

The library leverages [TSDX](https://tsdx.io/) as a boilerplate.

To run the library, use:

```bash
yarn start # or npm run start
```

This command builds to `/dist` and runs the project in watch mode, so any edits you save inside `src` causes a rebuild to `/dist`.

To do a one-off build, use:
```bash
yarn build # or npm run build
```

Jest tests are set up to run with:
```bash
yarn test # or npm run test
```

### Configuration

Code quality is set up with `prettier`, `husky`, and `lint-staged`.

### Bundle Analysis

[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of the library with:
```bash
yarn size # or npm run size
```

### Rollup

The library uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings.

## Module Formats

CJS, ESModules, and UMD module formats are supported.

---
_Source: https://npm.io/package/find-neighbors-in-matrix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
