Completed
Push — master ( 95de79...31de30 )
by Askupa
02:40
created

assets/js/_search.js   A

Complexity

Total Complexity 7
Complexity/F 1.75

Size

Lines of Code 27
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
nc 2
dl 0
loc 27
rs 10
c 1
b 0
f 0
wmc 7
mnd 2
bc 7
fnc 4
bpm 1.75
cpm 1.75
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A $(ꞌ#settings-searchꞌ).keyup 0 23 3
1
(function(){
2
    var $fields = $('.amarkal-settings-field');
3
    
4
    $('#settings-search').on('keyup',function(e){
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

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.

Loading history...
5
        var query    = $(this).val().toLowerCase(),
6
            matches  = [];
7
            
8
        if(query.length > 1) {
9
            $fields.hide().each(function(){
10
                var $field = $(this),
11
                    title  = $field.attr('data-title').toLowerCase();
12
                    
13
                if(title.match(query)){
14
                    matches.push($field);
15
                }
16
            });
17
            
18
            $(matches).map(function(){return this.toArray();}).show();
19
            
20
            $('#settings-search-results').text(matches.length ? matches.length+' settings found' : 'Nothing found');
21
        }
22
        else {
23
            $fields.show();
24
            $('#settings-search-results').text('');
25
        }
26
    });
27
})();