Skip to content

Latest commit

 

History

History
 
 

plugin-remove-useless-array-entries

@putout/plugin-remove-useless-array-entries NPM version

The entries() method returns a new Array Iterator object that contains the key/value pairs for each index in the array.

(c) MDN

🐊Putout plugin adds ability to remove useless array.entries().

Install

npm i @putout/plugin-remove-useless-array-entries

Rule

{
    "rules": {
        "remove-useless-array-entries": "on"
    }
}

❌ Example of incorrect code

for (const [, element] of array.entries()) {
    console.log(element);
}

✅ Example of correct code

for (const element of array) {
    console.log(element);
}

License

MIT