@putout/plugin-convert-object-keys-to-object-entries
v1.0.0
Published
šPutout plugin adds ability to convert 'Object.keys()' to 'Object.entries()'
Downloads
15,782
Maintainers
Readme
@putout/plugin-convert-object-keys-to-object-entries 
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 -DCheckout 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
