Skip to content

Commit

Permalink
Remove marker by id (#2749)
Browse files Browse the repository at this point in the history
* remove marker by id

* better implementation

* remove extra whitespace
  • Loading branch information
prakharpbuf committed Apr 3, 2023
1 parent f9d5641 commit a4dbddb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plugin/markers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,13 @@ export default class MarkersPlugin {
/**
* Remove a marker
*
* @param {number} index Index of the marker to remove
* @param {number|Object} indexOrMarker Index of the marker to remove or the marker object itself
*/
remove(index) {
remove(indexOrMarker) {
let index = indexOrMarker;
if (isNaN(index)) {
index = this.markers.findIndex(marker => marker === indexOrMarker);
}
let marker = this.markers[index];
if (!marker) {
return;
Expand Down

0 comments on commit a4dbddb

Please sign in to comment.