Détail du package

@putout/plugin-remove-useless-map

coderaiser25.2kMIT2.0.0

🐊Putout plugin adds ability to remove useless .map

putout, putout-plugin, plugin, map

readme

@putout/plugin-remove-useless-map NPM version

The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.

(c) MDN

🐊Putout plugin adds ability to remove useless map().

Install

npm i @putout/plugin-remove-useless-map

Rule

{
    "rules": {
        "remove-useless-map": "on"
    }
}

❌ Example of incorrect code

const [str] = lines.map((line) => `hello ${line}`);

✅ Example of correct code

const [line] = lines;
const str = `hello ${line}`;

License

MIT