Closed Bug 1207363 Opened 4 years ago Closed 4 years ago

Use Array.includes in mail/ instead of indexOf != / == -1

Categories

(Thunderbird :: General, enhancement)

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 44.0

People

(Reporter: aryx, Assigned: aryx)

Details

Attachments

(1 file)

Attachment #8664510 - Flags: review?(mkmelin+mozilla) → review+
https://hg.mozilla.org/comm-central/rev/0c9f89670ac8
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 44.0
Did you do this with a script? If yes, can we run it on im/ and chat/ too? ;)
Just out of interest: What's the practical value of this?
According to this
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
it's experimental and was introduced at gecko43.
From bug 1208849 comment 0:
> [...] I do this for relaxing and looking at code to learn and spot other bugs (found bug 1207364 that way).

> According to this
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/
> Global_Objects/Array/includes
> it's experimental and was introduced at gecko43.
It landed much earlier but was only enabled in Nightly. It does what String.prototype.includes does (available since Gecko 40) and the goal was to assign both methods the same name. So there was time for adaption to get tracktion and testing when it was enabled on Nightly.
(In reply to Jorg K (GMT+2) from comment #3)
> Just out of interest: What's the practical value of this?

It makes the code more readable, imho.
You need to log in before you can comment on or make changes to this bug.