# no-object-methods-with-collections πŸ“ Disallow `Object` methods with `Map` or `Set`. πŸ’ΌπŸš« This rule is enabled in the βœ… `recommended` [config](https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config). This rule is _disabled_ in the β˜‘οΈ `unopinionated` [config](https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config). πŸ’‘ This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions). Disallow `Object.keys()`, `Object.values()`, and `Object.entries()` with `Map` or `Set`. `Map` and `Set` contents are not own enumerable string-keyed properties, so `Object.keys(map)`, `Object.values(map)`, and `Object.entries(map)` usually return an empty array instead of the collection contents. This rule reports clear `Map`, `ReadonlyMap`, `Set`, and `ReadonlySet` values. It intentionally does not report `WeakMap`, `WeakSet`, unknown values, or userland collection types. If you intentionally attach enumerable properties to a `Map` or `Set`, disable the rule for that line. ## Examples ```js // ❌ const map = new Map([ ['a', 1], ['b', 2], ]); Object.keys(map); // βœ… Array.from(map.keys()); ``` ```js // ❌ const map = new Map([ ['a', 1], ['b', 2], ]); Object.values(map); // βœ… Array.from(map.values()); ``` ```js // ❌ const set = new Set(['a', 'b']); Object.entries(set); // βœ… Array.from(set.entries()); ```