@kizmann/pico-js 0.3.34 → 0.3.36

Sign up to get free protection for your applications and to get access to all the features.
package/docs/cookie.html CHANGED
@@ -29,6 +29,13 @@
29
29
  'use strict';
30
30
 
31
31
  pi.Dom.ready(function() {
32
+
33
+ var obj = {
34
+ foo: { bar: 'key' }, hu: 'tem', ka: { se: { nope: 'lol' } }
35
+ };
36
+
37
+ console.log(pi.Obj.flatten(obj));
38
+
32
39
  console.log(pi.Str.real('@[\'\']'));
33
40
  console.log(pi.Str.real('@[1,"foo",3]'));
34
41
  pi.Cookie.set('foobar1', { foo: 'bar', pi: { nano: 'ui', kyoto: 'cms' } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizmann/pico-js",
3
- "version": "0.3.34",
3
+ "version": "0.3.36",
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);
@@ -379,6 +379,34 @@ export class Obj
379
379
  return result;
380
380
  }
381
381
 
382
+ static flatten(obj)
383
+ {
384
+ let result = {};
385
+
386
+ let callback = (val, sey = null) => {
387
+
388
+ Arr.each(Any.keys(val), (key) => {
389
+
390
+ let tey = key;
391
+
392
+ if ( ! Any.isEmpty(sey) ) {
393
+ tey = `${sey}.${key}`;
394
+ }
395
+
396
+ if ( Any.isPlain(val[key]) ) {
397
+ return callback(val[key], tey);
398
+ }
399
+
400
+ result[tey] = val[key];
401
+ });
402
+
403
+ };
404
+
405
+ callback(obj);
406
+
407
+ return result;
408
+ }
409
+
382
410
  }
383
411
 
384
412
  export default Obj;