| Total Complexity | 4 |
| Complexity/F | 1.33 |
| Lines of Code | 16 |
| Function Count | 3 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /** |
||
| 6 | export function getRandomWinners(names, winnerCount = 1) { |
||
| 7 | for (let i = names.length - 1; i > 0; i--) { |
||
| 8 | const j = Math.floor(Math.random() * (i + 1)); |
||
| 9 | [names[i], names[j]] = [names[j], names[i]]; |
||
| 10 | } |
||
| 11 | return names.slice(0, winnerCount); |
||
| 12 | } |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @param {string} string - text that will be extracted |
||
| 16 | * @returns {array} list of extracted text |
||
| 17 | */ |
||
| 18 | export function extractMessage(string) { |
||
| 19 | const regex = /"[^"]+"|[^\s]+/g; |
||
| 20 | return string.match(regex).map((s) => s.replace(/"(.+)"/, '$1')); |
||
| 21 | } |
||
| 22 |