# @writetome51/array-remove-adjacent-to-value

> Array-handling function that removes items adjacent to (or near) a given value.

Latest version **1.0.3** (published 2019-02-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @writetome51/array-remove-adjacent-to-value
pnpm add @writetome51/array-remove-adjacent-to-value
yarn add @writetome51/array-remove-adjacent-to-value
bun add @writetome51/array-remove-adjacent-to-value
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-02-28 |
| First published | 2018-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Steve Thompson |
| Maintainers | writetome51 |
| Keywords | array, manipulation, remove, adjacent, items |

## Links

- npm: https://www.npmjs.com/package/@writetome51/array-remove-adjacent-to-value
- Repository: https://github.com/writetome51/array-remove-adjacent-to-value
- Homepage: https://github.com/writetome51/array-remove-adjacent-to-value#readme
- Issues: https://github.com/writetome51/array-remove-adjacent-to-value/issues
- npm.io page: https://npm.io/package/@writetome51/array-remove-adjacent-to-value

## Dependencies (2)

- [@writetome51/adjacent-to-value-info-interface](https://npm.io/package/@writetome51/adjacent-to-value-info-interface.md) ~1.0.2
- [@writetome51/array-get-and-remove-adjacent-to-value](https://npm.io/package/@writetome51/array-get-and-remove-adjacent-to-value.md) ~1.0.6

## Recent versions

- 1.0.3 (latest) — 2019-02-28
- 1.0.2 — 2018-11-17
- 1.0.1 — 2018-11-06
- 1.0.0 — 2018-09-28

## README

## removeAdjacentToValue(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value: anyExceptObject,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;offset: integer,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;howMany: integer_greater_than_zero<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array<br>): void

Removes `howMany` adjacent items from `array`, starting with, or  
close to, `value`.  Exactly where removal begins is decided by `offset`,  
which is the position, relative to `value`, where to begin removing.  
For example, if `offset` is 0, then removal begins at `value`.  If -1,  
it begins one place to the left of `value`.  If 1, it begins one place to the  
right.  

Note: the function only works with the first found instance of `value`.

### Examples
```
let array = [1,3,5,7,9,11,13,15,17];  
removeAdjacentToValue(
    {value: 11, offset: 0, howMany: 3},  
    array
);  
// items that get removed are [11,13,15] .  
// array is now [1,3,5,7,9,17].  


let array = [1,3,5,7,9,11,13,15,17];  
removeAdjacentToValue(
    {value: 11, offset: -2, howMany: 4}, 
    array
);  
// items that get removed are [7,9,11,13] .  
// array is now [1,3,5,15,17] .


let array = [1,3,5,7,9,11,13,15,17];  
removeAdjacentToValue(
    {value: 11, offset: 2, howMany: 2}, 
    array
);  
// items that get removed are [15,17] .  
// array is now [1,3,5,7,9,11,13] .
```

### Installation
`npm i  @writetome51/array-remove-adjacent-to-value`
 
    
### Loading
```
// if using TypeScript:
import {removeAdjacentToValue} from '@writetome51/array-remove-adjacent-to-value';
// if using ES5 JavaScript:
var removeAdjacentToValue = 
    require('@writetome51/array-remove-adjacent-to-value').removeAdjacentToValue;
```

---
_Source: https://npm.io/package/@writetome51/array-remove-adjacent-to-value · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
