Skip to content

Latest commit

 

History

History

plugin-apply-to-sorted

README.md

@putout/plugin-apply-to-sorted NPM version

The toSorted() method of Array instances is the copying version of the sort() method. It returns a new array with the elements sorted in ascending order. (c) MDN

🐊Putout plugin adds ability to apply toSorted.

Checkout in 🐊Putout Editor.

Install

npm i @putout/plugin-apply-to-sorted

Rule

{
    "rules": {
        "apply-to-sorted": "on"
    }
}

❌ Example of incorrect code

[...a].sort((a, b) => a - b);

✅ Example of correct code

a.toSorted((a, b) => a - b);

License

MIT