Commit d249c51
committed
refactor(Link/_voteForLink): Use Array#some
Instead of using Array#map, to build a list of IDs of users who voted,
and then use Array#includes to check if the user already voted, we can
use Array#some.
The main advantage is that when iterating, as soon as the callback returns
`true` the iteration stops.
See:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
Signed-off-by: Adrian Oprea <adrian@oprea.rocks>1 parent 4311b79 commit d249c51
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
0 commit comments