Total Complexity | 5 |
Complexity/F | 1.67 |
Lines of Code | 19 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | function addMessage(messages, message, value) { |
||
2 | messages.push(message.replace(/\{value\}/g, value)); |
||
3 | } |
||
4 | function isEmpty(value, trim) { |
||
5 | return value === null || value === undefined || value == [] |
||
6 | || value === '' || trim && $.trim(value) === ''; |
||
7 | } |
||
8 | function validatePhone(value, messages, options) { |
||
|
|||
9 | value = value.replace(/\D/g, ''); |
||
10 | |||
11 | if (isEmpty(value)) { |
||
12 | return; |
||
13 | } |
||
14 | |||
15 | if (value.length > 12 || value.length < 11) |
||
16 | addMessage(messages, "Телефонный номер должны быть длиною 11 или 12 цифр.", value); |
||
17 | |||
18 | |||
19 | } |
||
20 | |||
21 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.