# @putout/plugin-convert-object-entries-to-array-entries

> 🐊Putout plugin adds ability to convert 'const' to 'let'

Latest version **4.0.0** (published 2026-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @putout/plugin-convert-object-entries-to-array-entries
pnpm add @putout/plugin-convert-object-entries-to-array-entries
yarn add @putout/plugin-convert-object-entries-to-array-entries
bun add @putout/plugin-convert-object-entries-to-array-entries
```

## Health

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

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-01-28 |
| First published | 2023-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 801 |
| Author | coderaiser |
| Maintainers | coderaiser |
| Keywords | putout, putout-plugin, plugin, convert, const, let, var, VariableDeclaration |

## Links

- npm: https://www.npmjs.com/package/@putout/plugin-convert-object-entries-to-array-entries
- Repository: https://github.com/coderaiser/putout
- Homepage: https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-object-entries-to-array-entries#readme
- Issues: https://github.com/coderaiser/putout/issues
- npm.io page: https://npm.io/package/@putout/plugin-convert-object-entries-to-array-entries

## Recent versions

- 4.0.0 (latest) — 2026-01-28
- 3.0.2 — 2025-01-06
- 3.0.1 — 2023-08-14
- 3.0.0 — 2023-08-14
- 2.0.0 — 2023-06-07
- 1.0.1 — 2023-03-30
- 1.0.0 — 2023-03-30

## README

# @putout/plugin-convert-object-entries-to-array-entries [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-convert-object-entries-to-array-entries.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-convert-object-entries-to-array-entries "npm"

> The `Object.entries()` static method returns an array of a given object's own enumerable string-keyed property key-value pairs.
>
> (c) [`Object.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries)

> The `entries()` method returns a new `Array Iterator` object that contains the key/value pairs for each index in the array.
>
> (c) [`Array.prototype.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to convert `Object.entries()` to `Array.prototype.entries()` to avoid bugs
related to using `index` in unary (`!index`) or binary (`index > length`) expressions, the thing is `Object.entries()` returns list of `Array<String, any>` tuples,
and `Array.prototype.entries()` returns list of `Array<Number, any>` tuples it can lead to bugs when you expected that `index` is number.

Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/f902e1f52d551545cede97db4cfba345/dbae8bfd2c4b0b4ec9612e2002a87c2a5961204d).

## Install

```
npm i @putout/plugin-convert-object-entries-to-array-entries -D
```

## Rule

```json
{
    "rules": {
        "convert-object-entries-to-array-entries": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const {entries} = Object;

for (const [i, token] of entries(tokens)) {
    if (!i)
        continue;
    
    fn(token);
}
```

## ✅ Example of correct code

```js
for (const [i, token] of tokens.entries()) {
    if (!i)
        continue;
    
    fn(token);
}
```

## License

MIT

---
_Source: https://npm.io/package/@putout/plugin-convert-object-entries-to-array-entries · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
