src/icon_object.js   A
last analyzed

Complexity

Total Complexity 6
Complexity/F 2

Size

Lines of Code 37
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
eloc 26
c 1
b 0
f 0
nc 2
dl 0
loc 37
rs 10
wmc 6
mnd 1
bc 4
fnc 3
bpm 1.3333
cpm 2
noi 1

2 Functions

Rating   Name   Duplication   Size   Complexity  
A IconObject.toJSON 0 7 1
A icon_object.js ➔ IconObject 0 25 4
1
import { omit } from "./helpers.js";
2
3
function IconObject(url, fillColor, markerOpts) {
4
	this.url = url;
5
	this.fillColor = fillColor;
6
	this.markerOpts = markerOpts;
7
	Object.assign(this, markerOpts);
8
	if (window && window.google && window.google.maps) {
9
		this.origin = new google.maps.Point(
0 ignored issues
show
Bug introduced by
The variable google seems to be never declared. If this is a global, consider adding a /** global: google */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
10
			this.markerOpts.origin.x,
11
			this.markerOpts.origin.y
12
		);
13
		this.anchor = new google.maps.Point(
14
			this.markerOpts.anchor.x,
15
			this.markerOpts.anchor.y
16
		);
17
		this.size = new google.maps.Size(
18
			this.markerOpts.size.width,
19
			this.markerOpts.size.height
20
		);
21
		this.scaledSize = new google.maps.Size(
22
			this.markerOpts.scaledSize.width,
23
			this.markerOpts.scaledSize.height
24
		);
25
	}
26
	return this;
27
}
28
29
IconObject.prototype.toJSON = function() {
30
	var serialized = omit(this.markerOpts, function(prop) {
31
		return prop.indexOf("gm_") === 0 || prop === "url";
32
	});
33
	serialized.fillColor = this.fillColor;
34
	return serialized;
35
};
36
37
export { IconObject };
38