{"size": 665, "ext": "js", "max_stars_repo_path": "js/marker/Markers.js", "max_stars_repo_name": "lionkmp/osmhu-website", "max_stars_repo_stars_event_min_datetime": "2022-01-05T08:46:28.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-13T08:20:01.000Z", "max_issues_repo_path": "js/marker/Markers.js", "max_issues_repo_name": "lionkmp/osmhu-website", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/marker/Markers.js", "max_forks_repo_name": "lionkmp/osmhu-website", "max_forks_repo_forks_event_min_datetime": "2022-01-05T08:46:41.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-05T08:46:41.000Z"}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 22.9310344828, "max_line_length": 68, "alphanum_fraction": 0.7172932331}
import Marker from './Marker';

export default class Markers {
	constructor() {
		this.markers = {};
	}

	add(marker) {
		if (!(marker instanceof Marker)) {
			throw new Error('marker parameter should be instance of Marker');
		}
		const propertyName = marker.osmElementId.toObjectPropertyName();
		this.markers[propertyName] = marker;
	}

	getByOsmElementId(osmElementId) {
		const propertyName = osmElementId.toObjectPropertyName();
		return this.markers[propertyName];
	}

	getAllLeafletMarkers() {
		const leafletMarkers = [];
		Object.values(this.markers).forEach((marker) => {
			leafletMarkers.push(marker.leafletMarker);
		});
		return leafletMarkers;
	}
}
