src/javascript/app.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 25
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 25
c 0
b 0
f 0
rs 10
cc 0
nc 1
mnd 1
bc 5
fnc 4
bpm 1.25
cpm 1.25
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A $.entwine(ꞌssꞌ) 0 21 1
A 0 23 1
1
import SearchForm from './modules/SearchForm';
2
3
(function ($) {
4
    $.entwine('ss', function ($) {
5
        $('#lang-editor-cms-content').entwine({
6
            onmatch: function () {
7
                window.langeditor = {
8
                    instances: [],
9
                    modules: [
10
                        {name: 'search-form', class: SearchForm}
11
                    ]
12
                };
13
14
                window.langeditor.modules.forEach((item) => {
15
                    // try to find an element
16
                    let element = $(this).find(`*[data-module="${item.name}"]`);
17
18
                    if (element.length) {
19
                        window.langeditor.instances.push(new item.class(element[0]));
20
                    }
21
                });
22
            }
23
        });
24
    });
25
})(jQuery);