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().
npm i @putout/plugin-remove-useless-object-from-entries
{
"rules": {
"remove-useless-object-from-entries": "on"
}
}const a = {
b: Object.fromEntries(Object.entries({
hello: 'world',
})),
};const a = {
b: {
hello: 'world',
},
};MIT