* Argument validation * @param {String} str - String to be checked * @param {Number} a - A coefficient to be checked * @param {Number} b - B coefficient to be checked * @return {Boolean} Result of the checking
(str, a, b)
| 37 | * @return {Boolean} Result of the checking |
| 38 | */ |
| 39 | function isCorrectFormat(str, a, b) { |
| 40 | if (typeof a !== 'number' || typeof b !== 'number') { |
| 41 | throw new TypeError('Coefficient a, b should be number') |
| 42 | } |
| 43 | |
| 44 | if (typeof str !== 'string') { |
| 45 | throw new TypeError('Argument str should be String') |
| 46 | } |
| 47 | |
| 48 | if (!CoPrimeCheck(a, 26)) { |
| 49 | throw new Error(a + ' is not coprime of 26') |
| 50 | } |
| 51 | |
| 52 | return true |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Find character index based on ASCII order |
no test coverage detected