• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

georapbox / shuffle-letters / 5922937646

21 Aug 2023 06:46AM UTC coverage: 94.937% (+6.2%) from 88.75%
5922937646

push

github

georapbox
Update version

24 of 26 branches covered (92.31%)

Branch coverage included in aggregate %.

10 of 10 new or added lines in 1 file covered. (100.0%)

51 of 53 relevant lines covered (96.23%)

96.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/getRandomCharacterForType.js
1
/**
2
 * Get a pseudo-random character from an available pool depending on the type of the character.
3
 *
4
 * @param {string} charType The type of the character. Available values are "lowerCase", "upperCase" and "symbol".
5
 * @returns {string} Returns the pseudo-random character.
6
 */
7
export function getRandomCharacterForType(charType) {
8
  let charsPool = '';
86✔
9

10
  switch (charType) {
86!
11
    case 'lowerCase':
12
      charsPool = 'abcdefghijklmnopqrstuvwxyz';
51✔
13
      break;
51✔
14
    case 'upperCase':
15
      charsPool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
3✔
16
      break;
3✔
17
    case 'digit':
18
      charsPool = '0123456789';
12✔
19
      break;
12✔
20
    case 'symbol':
21
      charsPool = ',.?/\\(^)![]{}*&^%$#\'"';
20✔
22
      break;
20✔
23
    default:
24
      // Handle a default case if needed
25
      break;
×
26
  }
27

28
  const charsPoolArray = charsPool.split('');
86✔
29

30
  return charsPoolArray[Math.floor(Math.random() * charsPoolArray.length)];
86✔
31
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc