@putout/plugin-apply-at
v2.0.0
Published
šPutout plugin adds ability apply at()
Downloads
25,700
Maintainers
Readme
@putout/plugin-apply-at
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.
The
at()
method takes an integer value and returns a newString
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.>
š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