If an object is created from pairs, and only used to check existence and READ properties. Should prefer use new Map()
instead of Object.fromEntries()
, kind of similar to prefer-set-has
.
const object = Object.fromEntries(/*...*/);
if (object.foo) {
console.log(object.foo)
}
const object = new Map(/*...*/);
if (object.has('foo')) {
console.log(object.get('foo'))
}
// Object literal should be ignored
const object = {
// ...
};
if (object.foo) {
console.log(object.foo)
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too