# babel-plugin-transform-array-prototype-includes

> Transforms `arr.includes(value)` to ES5 without a polyfill

Latest version **1.2.1** (published 2025-06-11) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2025-06-11 |
| First published | 2020-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Marc Hassan |
| Maintainers | mhassan1 |
| Keywords | babel, babel-plugin, array, includes, polyfill |

## Links

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

## Recent versions

- 1.2.1 (latest) — 2025-06-11
- 1.2.0 — 2025-06-11
- 1.1.0 — 2025-06-10
- 1.0.0 — 2020-09-11

## README

# babel-plugin-transform-array-prototype-includes

Transforms `arr.includes(value)` to ES5 without a polyfill

Inspired by [babel-plugin-array-includes](https://github.com/stoeffel/babel-plugin-array-includes).

## Example

**In**

```javascript
[1, 2, 3].includes(1);
[1, 2, 3]['includes'](1);
arr.includes(1);
arr['includes'](1);
```

**Out**

```javascript
[1, 2, 3].indexOf(1) !== -1;
[1, 2, 3].indexOf(1) !== -1;
(function (o, a0) { return Array.isArray(o) ? o.indexOf(a0) !== -1 : o.includes(a0); })(arr, 1);
(function (o, a0) { return Array.isArray(o) ? o.indexOf(a0) !== -1 : o.includes(a0); })(arr, 1);
```

## Installation

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

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

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

### Via CLI

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

### Via Node API

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

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