src/syncer.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 3

Size

Lines of Code 25
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
dl 0
loc 25
ccs 5
cts 5
cp 1
cc 0
crap 0
rs 10
noi 0
wmc 3
mnd 1
bc 3
fnc 1
bpm 3
cpm 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A syncer.js ➔ syncerChooser 0 13 3
1
import CollectionSyncer from './syncers/collection'
2
import ItemSyncer from './syncers/item'
3
4
/**
5
 * Chooses and returns the preferred syncer
6
 *
7
 * @param Vue
8
 * @param vm
9
 * @param path
10
 * @param settings
11
 * @returns {BaseFeathersSyncer}
12
 */
13
export default function syncerChooser(Vue, vm, path, settings) {
14 10
	if (typeof settings === 'string') {
15 4
		settings = {
16
			service: settings
17
		}
18
	}
19
20
	// Choose syncer to use
21 10
	if ('id' in settings) {
22 5
		return new ItemSyncer(Vue, vm, path, settings)
23
	}
24 5
	return new CollectionSyncer(Vue, vm, path, settings)
25
}
26