@kizmann/pico-js 0.3.33 → 0.3.35

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizmann/pico-js",
3
- "version": "0.3.33",
3
+ "version": "0.3.35",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "author": "Eduard Kizmann <kizmann@protonmail.ch>",
@@ -358,8 +358,12 @@ export default class Map
358
358
 
359
359
  let item = { key };
360
360
 
361
+ if ( ! Obj.has(options, 'visible') ) {
362
+ options.visible = true;
363
+ }
364
+
361
365
  item.extras = Obj.except(options, [
362
- 'map', 'position', 'lat', 'lng', 'html', 'style'
366
+ 'map', 'position', 'lat', 'lng', 'html', 'style', 'visible'
363
367
  ]);
364
368
 
365
369
  if ( ! Obj.has(options, 'map') ) {
@@ -376,6 +380,10 @@ export default class Map
376
380
 
377
381
  item.marker = new global.google.maps.Marker(options);
378
382
 
383
+ if ( !options.visible ) {
384
+ item.marker.setVisible(false);
385
+ }
386
+
379
387
  Obj.set(this.markers, key, item);
380
388
 
381
389
  this.clusterMarkers(this.clusterOptions, null, false);
@@ -3,9 +3,37 @@ import Any from "./any";
3
3
 
4
4
  export class Obj
5
5
  {
6
- static has(obj, key)
6
+ static has(obj, keys)
7
7
  {
8
- return this.get(obj, key, - 1) !== - 1;
8
+ if ( obj === null || obj === undefined ) {
9
+ return false;
10
+ }
11
+
12
+ if ( keys === null || keys === undefined ) {
13
+ return false;
14
+ }
15
+
16
+ if ( Any.isArray(keys) ) {
17
+ keys = keys.join('.');
18
+ }
19
+
20
+ if ( ! Any.isString(keys) ) {
21
+ keys = keys.toString();
22
+ }
23
+
24
+ keys = keys.split('.');
25
+
26
+ let lst = keys.pop(), index = 0, length = keys.length;
27
+
28
+ while (obj !== undefined && obj !== null && index < length) {
29
+ obj = obj[keys[index++]];
30
+ }
31
+
32
+ if ( obj === undefined || obj === null) {
33
+ return false;
34
+ }
35
+
36
+ return obj[lst] !== undefined;
9
37
  }
10
38
 
11
39
  static empty(obj, key)