Skip to content

Latest commit

 

History

History

README.md

@putout/plugin-remove-useless-object-from-entries NPM version

The Object.fromEntries() static method transforms a list of key-value pairs into an object.

(c) MDN

🐊Putout plugin adds ability to remove useless Object.fromEntries().

Install

npm i @putout/plugin-remove-useless-object-from-entries

Rule

{
    "rules": {
        "remove-useless-object-from-entries": "on"
    }
}

❌ Example of incorrect code

const a = {
    b: Object.fromEntries(Object.entries({
        hello: 'world',
    })),
};

✅ Example of correct code

const a = {
    b: {
        hello: 'world',
    },
};

License

MIT