# babel-plugin-array-includes

> Replaces `arr.includes(val)' with `arr.indexOf(val) >= 0`.

Latest version **2.0.3** (published 2016-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-array-includes
pnpm add babel-plugin-array-includes
yarn add babel-plugin-array-includes
bun add babel-plugin-array-includes
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2016-01-27 |
| First published | 2015-06-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Author | Christoph Hermann |
| Maintainers | schtoeffel |
| Keywords | babel, babel-plugin, array, includes, polyfill |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-array-includes
- Repository: https://github.com/stoeffel/babel-plugin-array-includes
- Homepage: https://github.com/stoeffel/babel-plugin-array-includes#readme
- Issues: https://github.com/stoeffel/babel-plugin-array-includes/issues
- npm.io page: https://npm.io/package/babel-plugin-array-includes

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.0.3 (latest) — 2016-01-27
- 2.0.2 — 2015-12-18
- 2.0.1 — 2015-12-18
- 1.1.1 — 2015-06-24
- 1.1.0 — 2015-06-24
- 1.0.1 — 2015-06-24

## README

# babel-plugin-array-includes

> Replaces `arr.includes(val)` with `arr.indexOf(val) >= 0`.

Thanks to [@sebmck](https://github.com/sebmck) for the help.

## Example

**In**

```javascript
[1, 2, 3, 5, 8, 13].includes(4);
```

**Out**

```javascript
"use strict";

[1, 2, 3, 5, 8, 13].indexOf(4) >= 0;
```

## Pitfalls

This doesn't work:

**In**

```js
function foo(arr) {
  return arr.includes('foo');
}
```

**Out**

```js
function foo(arr) {
  return arr.includes('foo'); // still includes
}
```

## Installation

```sh
$ npm install babel-plugin-array-includes
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["array-includes"]
}
```

### Via CLI

```sh
$ babel --plugins array-includes script.js
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  plugins: ["array-includes"]
});
```

---
_Source: https://npm.io/package/babel-plugin-array-includes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
