@putout/plugin-apply-at

2.0.0 • Public • Published

@putout/plugin-apply-at NPM version

The at() method takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array.

(c) Array.prototype.at()

The at() method takes an integer value and returns a new String consisting of the single UTF-16 code unit located at the specified offset. This method allows for positive and negative integers. Negative integers count back from the last string character.>

(c) String.prototype.at()

🐊Putout plugin adds ability to apply array.at().

Install

npm i @putout/plugin-apply-at

Rule

{
    "rules": {
        "apply-at": "on"
    }
}

❌ Example of incorrect code

const latest = (a) => a[a.length - 1];

✅ Example of correct code

const latest = (a) => a.at(-1);

License

MIT

Package Sidebar

Install

npm i @putout/plugin-apply-at

Weekly Downloads

3,437

Version

2.0.0

License

MIT

Unpacked Size

4.31 kB

Total Files

4

Last publish

Collaborators

  • coderaiser