Total Complexity | 5 |
Complexity/F | 1.67 |
Lines of Code | 25 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /** |
||
18 | import Tokenfield from 'tokenfield'; |
||
19 | |||
20 | // Tokenize any seomatic-keywords fields |
||
21 | let el = document.querySelector('.seomatic-keywords'); |
||
22 | let keywords = el.value.split(',').map((value, index) => { |
||
23 | if (value !== '') { |
||
|
|||
24 | return { id: index, name: value }; |
||
25 | } |
||
26 | }); |
||
27 | let options = { |
||
28 | el: el, |
||
29 | addItemOnBlur: true, |
||
30 | addItemsOnPaste: true, |
||
31 | delimiters: [','], |
||
32 | }; |
||
33 | if (keywords !== undefined && keywords[0] !== undefined) { |
||
34 | options.setItems = keywords; |
||
35 | } |
||
36 | let tf = new Tokenfield(options); |
||
37 | tf.on('change', (tokenField) => { |
||
38 | let values = tokenField._vars.setItems.map((value) => { |
||
39 | return value.name; |
||
40 | }); |
||
41 | tokenField.el.value = values.join(','); |
||
42 | }); |
||
43 |
This check looks for functions where a
return
statement is found in some execution paths, but not in all.Consider this little piece of code
The function
isBig
will only return a specific value when its parameter is bigger than 5000. In any other case, it will implicitly returnundefined
.This behaviour may not be what you had intended. In any case, you can add a
return undefined
to the other execution path to make the return value explicit.