nextcloud /
notes
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | import Vue from 'vue' |
||
|
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: Loading history...
|
|||
| 2 | import Vuex from 'vuex' |
||
|
0 ignored issues
–
show
'import' is only available in ES6 (use 'esversion: 6').
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code. Further Reading: Loading history...
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: Loading history...
|
|||
| 3 | |||
| 4 | Vue.use(Vuex) |
||
|
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: Loading history...
|
|||
| 5 | |||
| 6 | |||
| 7 | function nthIndexOf(str, pattern, n) { |
||
| 8 | var i = -1; |
||
| 9 | while (n-- && i++ < str.length) { |
||
| 10 | i = str.indexOf(pattern, i); |
||
| 11 | if (i < 0) { |
||
| 12 | break; |
||
| 13 | } |
||
| 14 | } |
||
| 15 | return i; |
||
| 16 | } |
||
| 17 | |||
| 18 | |||
| 19 | export default new Vuex.Store({ |
||
|
0 ignored issues
–
show
'export' is only available in ES6 (use 'esversion: 6').
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code. Further Reading: Loading history...
|
|||
| 20 | state: { |
||
| 21 | notes: [] |
||
| 22 | }, |
||
| 23 | mutations: { |
||
| 24 | updateNotes(state, notes) { |
||
|
0 ignored issues
–
show
|
|||
| 25 | state.notes.length = 0 |
||
|
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: Loading history...
|
|||
| 26 | state.notes.push.apply(state.notes, notes) |
||
|
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: Loading history...
|
|||
| 27 | }, |
||
| 28 | }, |
||
| 29 | getters: { |
||
| 30 | getCategories: (state) => (maxLevel, details) => { |
||
|
0 ignored issues
–
show
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code. Further Reading: Loading history...
|
|||
| 31 | var categories = {}; |
||
| 32 | var notes = state.notes; |
||
| 33 | for(var i=0; i<notes.length; i+=1) { |
||
| 34 | var cat = notes[i].category; |
||
| 35 | if(maxLevel>0) { |
||
| 36 | var index = nthIndexOf(cat, '/', maxLevel); |
||
| 37 | if(index>0) { |
||
| 38 | cat = cat.substring(0, index); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | if(categories[cat]===undefined) { |
||
| 42 | categories[cat] = 1; |
||
| 43 | } else { |
||
| 44 | categories[cat] += 1; |
||
| 45 | } |
||
| 46 | } |
||
| 47 | var result = []; |
||
| 48 | for(var category in categories) { |
||
| 49 | if(details) { |
||
| 50 | result.push({ |
||
| 51 | name: category, |
||
| 52 | count: categories[category], |
||
| 53 | }); |
||
| 54 | } else if(category) { |
||
| 55 | result.push(category); |
||
| 56 | } |
||
| 57 | } |
||
| 58 | if(!details) { |
||
| 59 | result.sort(); |
||
| 60 | } |
||
| 61 | return result; |
||
| 62 | }, |
||
| 63 | }, |
||
| 64 | }) |
||
|
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: Loading history...
|
|||
| 65 | |||
| 66 |
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.
Further Reading: