@putout/plugin-convert-object-keys-to-object-entries
🐊Putout plugin adds ability to convert 'Object.keys()' to 'Object.entries()'
Last updated 7 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @putout/plugin-convert-object-keys-to-object-entries 
SYNC missed versions from official npm registry.

@putout/plugin-convert-object-keys-to-object-entries NPM version

The Object.keys() static method returns an array of a given object's own enumerable string-keyed property key-value pairs.

(c) Object.keys()

The Object.entries() static method returns an array of a given object's own enumerable string-keyed property key-value pairs.

(c) Object.entries()

????Putout plugin adds ability to convert Object.entries() to Object.keys()

Install

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

Checkout in ????Putout Editor.

Rule

{
    "rules": {
        "convert-object-keys-to-object-entries": "on"
    }
}

❌ Example of incorrect code

for (const [key, value] of Object.keys(tokens)) {
    console.log(key, value);
}

for (const [key, value] of keys(tokens)) {
    console.log(key, value);
}

✅ Example of correct code

for (const [key, value] of Object.entries(tokens)) {
    console.log(key, value);
}

for (const [key, value] of Object.entries(tokens)) {
    console.log(key, value);
}

License

MIT

Current Tags

  • 1.0.0                                ...           latest (7 months ago)

1 Versions

  • 1.0.0                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (6)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |