@kizmann/pico-js 0.3.15 → 0.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizmann/pico-js",
3
- "version": "0.3.15",
3
+ "version": "0.3.18",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "author": "Eduard Kizmann <kizmann@protonmail.ch>",
@@ -16,6 +16,8 @@ export default class Map
16
16
 
17
17
  cluster = null;
18
18
 
19
+ clusterFilter = null;
20
+
19
21
  clusterOptions = {};
20
22
 
21
23
  static hideMarkers = true;
@@ -115,18 +117,22 @@ export default class Map
115
117
  }
116
118
 
117
119
  if ( this.cluster ) {
118
- this.cluster.clearMarkers()
120
+ this.cluster.clearMarkers();
121
+ }
122
+
123
+ if ( Any.isFunction(filter) ) {
124
+ this.clusterFilter = filter;
119
125
  }
120
126
 
121
127
  let markers = Arr.filter(this.markers, (item) => {
122
128
 
123
129
  let visible = this.getMarkerVisibility(item.key);
124
130
 
125
- if ( ! Any.isFunction(filter) ) {
131
+ if ( ! Any.isFunction(this.clusterFilter) ) {
126
132
  return visible;
127
133
  }
128
134
 
129
- return visible && filter.call(this, item);
135
+ return visible && this.clusterFilter.call(this, item);
130
136
  });
131
137
 
132
138
  this.cluster = new global.MarkerClusterer(this.map, Arr.each(markers, (item) => item.marker),
@@ -372,7 +378,7 @@ export default class Map
372
378
 
373
379
  Obj.set(this.markers, key, item);
374
380
 
375
- this.clusterMarkers(this.clusterOptions, false);
381
+ this.clusterMarkers(this.clusterOptions, null, false);
376
382
 
377
383
  if ( ! Obj.has(options, 'html') ) {
378
384
  return Obj.get(this.markers, key);
@@ -460,7 +466,7 @@ export default class Map
460
466
 
461
467
  Obj.each(markers, (item) => this.showMarker(item.key));
462
468
 
463
- this.clusterMarkers(this.clusterOptions, false);
469
+ this.clusterMarkers(this.clusterOptions, null, false);
464
470
 
465
471
  return this;
466
472
  }
@@ -91,6 +91,10 @@ export class Num
91
91
 
92
92
  static format(num, decimal = '.', thousand = ',', fixed = null)
93
93
  {
94
+ if ( num === null ) {
95
+ return null;
96
+ }
97
+
94
98
  let value = num.toString();
95
99
 
96
100
  if ( fixed !== null && fixed !== - 1 ) {
@@ -98,7 +102,7 @@ export class Num
98
102
  }
99
103
 
100
104
  let totals = value.replace(/\.[0-9]+$/, ''),
101
- minals = value.replace(/^[0-9]+\./, '');
105
+ minals = value.replace(/^[0-9\-]+\./, '');
102
106
 
103
107
  let splits = Arr.reduce(totals.split('').reverse(), (result, val, key) => {
104
108
 
@@ -10,6 +10,11 @@ export class Str
10
10
  return String(val).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
11
11
  }
12
12
 
13
+ static upper(val)
14
+ {
15
+ return String(val).toUpperCase();
16
+ }
17
+
13
18
  static lower(val)
14
19
  {
15
20
  return String(val).toLowerCase();