@kizmann/pico-js 2.0.7 → 2.0.9

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.
Files changed (97) hide show
  1. package/dist/pico-js.browser.js +1 -1
  2. package/dist/pico-js.browser.js.map +1 -1
  3. package/dist/pico-js.esm.js +1 -1
  4. package/dist/pico-js.esm.js.map +1 -1
  5. package/package.json +4 -6
  6. package/src/dom/{DomAttribute.js → DomAttribute.ts} +40 -63
  7. package/src/dom/{DomBuilder.js → DomBuilder.ts} +27 -44
  8. package/src/dom/{DomEvent.js → DomEvent.ts} +101 -76
  9. package/src/dom/{DomFinder.js → DomFinder.ts} +103 -139
  10. package/src/dom/DomForm.ts +38 -0
  11. package/src/dom/{DomGlobal.js → DomGlobal.ts} +34 -51
  12. package/src/dom/{DomInview.js → DomInview.ts} +37 -57
  13. package/src/dom/DomMeta.ts +48 -0
  14. package/src/dom/DomObserver.ts +17 -0
  15. package/src/dom/{DomPopover.js → DomPopover.ts} +20 -39
  16. package/src/dom/{DomRectangle.js → DomRectangle.ts} +70 -87
  17. package/src/format/{FormatFile.js → FormatFile.ts} +12 -23
  18. package/src/format/{FormatOption.js → FormatOption.ts} +15 -24
  19. package/src/format/{FormatParam.js → FormatParam.ts} +14 -25
  20. package/src/format/{FormatParser.js → FormatParser.ts} +29 -39
  21. package/src/format/{FormatUrl.js → FormatUrl.ts} +9 -21
  22. package/src/index.browser.ts +32 -0
  23. package/src/index.esm.ts +64 -0
  24. package/src/now/{NowDefault.js → NowDefault.ts} +86 -121
  25. package/src/now/{NowFormat.js → NowFormat.ts} +23 -28
  26. package/src/now/{NowGrid.js → NowGrid.ts} +41 -58
  27. package/src/now/{NowHuman.js → NowHuman.ts} +18 -27
  28. package/src/now/{NowMatch.js → NowMatch.ts} +22 -28
  29. package/src/now/{NowRange.js → NowRange.ts} +13 -22
  30. package/src/now/{NowWalker.js → NowWalker.ts} +65 -71
  31. package/src/tool/{scope.js → scope.ts} +41 -11
  32. package/src/utils/{Array.js → Array.ts} +187 -152
  33. package/src/utils/{Cookie.js → Cookie.ts} +15 -12
  34. package/src/utils/{Data.js → Data.ts} +17 -17
  35. package/src/utils/Dom.ts +204 -0
  36. package/src/utils/Format.ts +48 -0
  37. package/src/utils/{Hash.js → Hash.ts} +20 -20
  38. package/src/utils/{Locale.js → Locale.ts} +21 -21
  39. package/src/utils/{Mixed.js → Mixed.ts} +104 -61
  40. package/src/utils/{Now.js → Now.ts} +68 -69
  41. package/src/utils/{Number.js → Number.ts} +34 -36
  42. package/src/utils/{Object.js → Object.ts} +68 -122
  43. package/src/utils/{Route.js → Route.ts} +11 -9
  44. package/src/utils/{Runner.js → Runner.ts} +89 -77
  45. package/src/utils/{Signal.js → Signal.ts} +35 -22
  46. package/src/utils/{String.js → String.ts} +79 -69
  47. package/src/wip/{Element.js → Element.ts} +2 -2
  48. package/src/wip/{Map.js → Map.ts} +1 -1
  49. package/types/dom/DomAttribute.d.ts +16 -27
  50. package/types/dom/DomBuilder.d.ts +6 -9
  51. package/types/dom/DomEvent.d.ts +19 -24
  52. package/types/dom/DomFinder.d.ts +38 -61
  53. package/types/dom/DomForm.d.ts +7 -10
  54. package/types/dom/DomGlobal.d.ts +8 -15
  55. package/types/dom/DomInview.d.ts +9 -19
  56. package/types/dom/DomMeta.d.ts +9 -16
  57. package/types/dom/DomObserver.d.ts +4 -8
  58. package/types/dom/DomPopover.d.ts +8 -11
  59. package/types/dom/DomRectangle.d.ts +21 -35
  60. package/types/format/FormatFile.d.ts +5 -8
  61. package/types/format/FormatOption.d.ts +6 -8
  62. package/types/format/FormatParam.d.ts +6 -9
  63. package/types/format/FormatParser.d.ts +10 -18
  64. package/types/format/FormatUrl.d.ts +5 -8
  65. package/types/index.esm.d.ts +25 -37
  66. package/types/now/NowDefault.d.ts +30 -99
  67. package/types/now/NowFormat.d.ts +8 -21
  68. package/types/now/NowGrid.d.ts +24 -46
  69. package/types/now/NowHuman.d.ts +10 -11
  70. package/types/now/NowMatch.d.ts +6 -4
  71. package/types/now/NowRange.d.ts +5 -8
  72. package/types/now/NowWalker.d.ts +6 -4
  73. package/types/tool/scope.d.ts +11 -3
  74. package/types/utils/Array.d.ts +83 -101
  75. package/types/utils/Cookie.d.ts +11 -8
  76. package/types/utils/Data.d.ts +7 -7
  77. package/types/utils/Dom.d.ts +63 -96
  78. package/types/utils/Format.d.ts +15 -28
  79. package/types/utils/Hash.d.ts +21 -21
  80. package/types/utils/Locale.d.ts +9 -9
  81. package/types/utils/Mixed.d.ts +19 -32
  82. package/types/utils/Now.d.ts +51 -56
  83. package/types/utils/Number.d.ts +9 -20
  84. package/types/utils/Object.d.ts +21 -36
  85. package/types/utils/Route.d.ts +5 -2
  86. package/types/utils/Runner.d.ts +45 -38
  87. package/types/utils/Signal.d.ts +16 -16
  88. package/types/utils/String.d.ts +40 -76
  89. package/src/dom/DomForm.js +0 -59
  90. package/src/dom/DomMeta.js +0 -68
  91. package/src/dom/DomObserver.js +0 -38
  92. package/src/index.browser.js +0 -36
  93. package/src/index.esm.js +0 -80
  94. package/src/utils/Dom.js +0 -214
  95. package/src/utils/Format.js +0 -62
  96. package/types/wip/Element.d.ts +0 -119
  97. package/types/wip/Map.d.ts +0 -254
@@ -1,4 +1,4 @@
1
- import { go, Mix, Arr } from "../index.esm.js";
1
+ import { Mix, Arr } from "../index.esm.ts";
2
2
 
3
3
  export class PicoObject
4
4
  {
@@ -10,10 +10,10 @@ export class PicoObject
10
10
  *
11
11
  * @param {any} keys Key path
12
12
  * @param {boolean} [flatten] Flatten keys
13
- * @param {boolean|null} [isstr] Is string flag
13
+ * @param {boolean} [isstr] Is string flag
14
14
  * @returns {Array<any>} Key segments
15
15
  */
16
- static keyoptim(keys, flatten = false, isstr = null)
16
+ static keyoptim(keys : any, flatten : boolean = false, isstr : boolean = null) : Array<any>
17
17
  {
18
18
  if ( isstr === null ) {
19
19
  isstr = Mix.isStr(keys);
@@ -37,7 +37,7 @@ export class PicoObject
37
37
  * @param {boolean} [flatten] Flatten keys
38
38
  * @returns {boolean} True if exists
39
39
  */
40
- static has(target, keys, flatten = false)
40
+ static has(target : any, keys : any, flatten : boolean = false) : boolean
41
41
  {
42
42
  if ( target == null || keys == null ) {
43
43
  return false;
@@ -63,8 +63,8 @@ export class PicoObject
63
63
  return target[list] !== undefined;
64
64
  }
65
65
 
66
- while ( target != null && index < length ) {
67
- target = target[keys[index ++]];
66
+ while (target != null && index < length) {
67
+ target = target[keys[index++]];
68
68
  }
69
69
 
70
70
  if ( target == null ) {
@@ -87,7 +87,7 @@ export class PicoObject
87
87
  * @param {boolean} [flatten] Flatten keys
88
88
  * @returns {any} Nested value
89
89
  */
90
- static get(target, keys, fallback = null, flatten = false)
90
+ static get(target : any, keys : any, fallback : any = null, flatten : boolean = false) : any
91
91
  {
92
92
  if ( target == null || keys == null ) {
93
93
  return fallback;
@@ -111,8 +111,8 @@ export class PicoObject
111
111
  return fallback;
112
112
  }
113
113
 
114
- while ( target != null && index < length ) {
115
- target = target[keys[index ++]];
114
+ while (target != null && index < length) {
115
+ target = target[keys[index++]];
116
116
  }
117
117
 
118
118
  if ( target == null ) {
@@ -134,7 +134,7 @@ export class PicoObject
134
134
  * @param {boolean} [flatten] Flatten keys
135
135
  * @returns {any} Mutated target
136
136
  */
137
- static set(target, keys, value, flatten = false)
137
+ static set(target : any, keys : any, value : any, flatten : boolean = false) : any
138
138
  {
139
139
  if ( keys == null ) {
140
140
  return target;
@@ -158,7 +158,7 @@ export class PicoObject
158
158
 
159
159
  let nested = target;
160
160
 
161
- for ( let mod, src, i = 0; i < keys.length; i++) {
161
+ for ( let mod : any, src : any, i = 0; i < keys.length; i++ ) {
162
162
 
163
163
  mod = src = String(keys[i]);
164
164
 
@@ -195,7 +195,7 @@ export class PicoObject
195
195
  * @param {boolean} [flatten] Flatten keys
196
196
  * @returns {any} Mutated target
197
197
  */
198
- static unset(target, keys, flatten = false)
198
+ static unset(target : any, keys : any, flatten : boolean = false) : any
199
199
  {
200
200
  if ( keys == null ) {
201
201
  return target;
@@ -221,8 +221,8 @@ export class PicoObject
221
221
  return target;
222
222
  }
223
223
 
224
- while ( nested != null && index < length ) {
225
- nested = nested[keys[index ++]];
224
+ while (nested != null && index < length) {
225
+ nested = nested[keys[index++]];
226
226
  }
227
227
 
228
228
  if ( nested == null ) {
@@ -242,7 +242,7 @@ export class PicoObject
242
242
  * @param {any} key Key path
243
243
  * @returns {boolean} True if empty
244
244
  */
245
- static empty(target, key)
245
+ static empty(target : any, key : any) : boolean
246
246
  {
247
247
  return Mix.isEmpty(this.get(target, key));
248
248
  }
@@ -258,7 +258,7 @@ export class PicoObject
258
258
  */
259
259
  static remove(target, keys)
260
260
  {
261
- if ( ! Mix.isArr(keys) ) {
261
+ if ( !Mix.isArr(keys) ) {
262
262
  return target;
263
263
  }
264
264
 
@@ -275,11 +275,11 @@ export class PicoObject
275
275
  * @example Obj.each({a:1}, v => v+1) // => {a:2}
276
276
  *
277
277
  * @param {any} value Source object
278
- * @param {function} cb Map callback
278
+ * @param {Function} cb Map callback
279
279
  * @param {any} [retval] Forced return
280
280
  * @returns {any} Mapped object
281
281
  */
282
- static each(value, cb, retval = null)
282
+ static each(value : any, cb : Function, retval : any = null) : any
283
283
  {
284
284
  let result = {};
285
285
 
@@ -300,10 +300,10 @@ export class PicoObject
300
300
  * @example Obj.map({a:1}, v => v+1) // => {a:2}
301
301
  *
302
302
  * @param {any} value Source object
303
- * @param {function} cb Map callback
303
+ * @param {Function} cb Map callback
304
304
  * @returns {Record<string, any>} Mapped object
305
305
  */
306
- static map(value, cb)
306
+ static map(value : any, cb : Function) : Record<string, any>
307
307
  {
308
308
  for ( let key of Mix.keys(value) ) {
309
309
  value[key] = cb(value[key], key);
@@ -321,7 +321,7 @@ export class PicoObject
321
321
  * @param {any} [filter] Filter spec
322
322
  * @returns {Array<any>} Key list
323
323
  */
324
- static filterIndex(value, filter = null)
324
+ static filterIndex(value : any, filter : any = null) : Array<any>
325
325
  {
326
326
  return Arr.filterIndex(value, filter);
327
327
  }
@@ -335,11 +335,11 @@ export class PicoObject
335
335
  * @param {any} [filter] Filter spec
336
336
  * @returns {Record<string, any>} Filtered object
337
337
  */
338
- static filter(value, filter = null)
338
+ static filter(value : any, filter : any = null) : Record<string, any>
339
339
  {
340
340
  let result = {};
341
341
 
342
- for (let key of this.filterIndex(value, filter)) {
342
+ for ( let key of this.filterIndex(value, filter) ) {
343
343
  result[key] = value[key];
344
344
  }
345
345
 
@@ -353,10 +353,10 @@ export class PicoObject
353
353
  *
354
354
  * @param {any} value Source object
355
355
  * @param {string} [prefix] Key prefix
356
- * @param {Record<string, any>} [result] Result map
356
+ * @param {any} [result] Result map
357
357
  * @returns {Record<string, any>} Flat map
358
358
  */
359
- static flatten(value, prefix = '', result = {})
359
+ static flatten(value : any, prefix : string = '', result : any = {}) : Record<string, any>
360
360
  {
361
361
  if ( typeof value !== 'object' ) {
362
362
  return result[prefix] = value;
@@ -380,16 +380,16 @@ export class PicoObject
380
380
  *
381
381
  * @param {any} value Source object
382
382
  * @param {string} [prefix] Key prefix
383
- * @param {Record<string, any>} [result] Result map
383
+ * @param {any} [result] Result map
384
384
  * @returns {Record<string, any>} Flat map
385
385
  */
386
- static flattenForm(value, prefix = '', result = {})
386
+ static flattenForm(value : any, prefix : string = '', result : any = {}) : Record<string, any>
387
387
  {
388
388
  if ( typeof value !== 'object' ) {
389
389
  return result[prefix] = value;
390
390
  }
391
391
 
392
- let fn = (key) => {
392
+ let fn = (key : any) => {
393
393
  return prefix ? `${prefix}[${key}]` : key;
394
394
  };
395
395
 
@@ -406,12 +406,12 @@ export class PicoObject
406
406
  * @example Obj.unpack({"a.b":1}) // => {a:{b:1}}
407
407
  *
408
408
  * @param {any} value Flat key map
409
- * @param {Record<string, any>} [result] Result object
410
- * @returns {Record<string, any>} Unpacked object
409
+ * @param {any} [result] Result object
410
+ * @returns {any} Unpacked object
411
411
  */
412
- static unpack(value, result = {})
412
+ static unpack(value : any, result : any = {}) : any
413
413
  {
414
- Arr.each(Mix.keys(value), (key) => {
414
+ Arr.each(Mix.keys(value), (key : any) => {
415
415
  this.set(result, key, value[key]);
416
416
  });
417
417
 
@@ -423,11 +423,12 @@ export class PicoObject
423
423
  *
424
424
  * @example Obj.assign({}, {a:1}) // => {a:1}
425
425
  *
426
- * @param {...any} args Assign args
426
+ * @param {[...any]} args Assign args
427
427
  * @returns {any} Assigned object
428
428
  */
429
- static assign(...args)
429
+ static assign(...args : [...any]) : any
430
430
  {
431
+ // @ts-ignore
431
432
  return Object.assign(...args);
432
433
  }
433
434
 
@@ -440,7 +441,7 @@ export class PicoObject
440
441
  * @param {any} [merge] Merge values
441
442
  * @returns {any} Cloned value
442
443
  */
443
- static clone(value, merge = null)
444
+ static clone(value : any, merge : any = null) : any
444
445
  {
445
446
  if ( Mix.isPrim(value) ) {
446
447
  return value;
@@ -450,7 +451,7 @@ export class PicoObject
450
451
  return Arr.clone(value);
451
452
  }
452
453
 
453
- if ( ! Mix.isObj(value) ) {
454
+ if ( !Mix.isObj(value) ) {
454
455
  return value;
455
456
  }
456
457
 
@@ -477,7 +478,7 @@ export class PicoObject
477
478
  * @param {any} [fallback] Fallback value
478
479
  * @returns {any} Plucked value
479
480
  */
480
- static pluck(value, key, fallback = null)
481
+ static pluck(value : any, key : any, fallback : any = null) : any
481
482
  {
482
483
  let result = this.get(value, key, fallback);
483
484
 
@@ -492,15 +493,15 @@ export class PicoObject
492
493
  * @example Obj.only({a:1,b:2}, ["a"]) // => {a:1}
493
494
  *
494
495
  * @param {any} value Source object
495
- * @param {Array<any>} keys Allowed keys
496
+ * @param {string[]} keys Allowed keys
496
497
  * @param {any} [merge] Merge values
497
- * @returns {Record<string, any>} Picked object
498
+ * @returns {any} Picked object
498
499
  */
499
- static only(value, keys, merge = null)
500
+ static only(value : any, keys : string[], merge : any = null) : any
500
501
  {
501
502
  let result = {};
502
503
 
503
- this.each(value, (val, key) => {
504
+ this.each(value, (val : any, key : any) => {
504
505
  if ( Arr.has(keys, key) ) result[key] = val;
505
506
  });
506
507
 
@@ -517,16 +518,16 @@ export class PicoObject
517
518
  * @example Obj.except({a:1,b:2}, ["a"]) // => {b:2}
518
519
  *
519
520
  * @param {any} value Source object
520
- * @param {Array<any>} keys Excluded keys
521
+ * @param {string[]} keys Excluded keys
521
522
  * @param {any} [merge] Merge values
522
- * @returns {Record<string, any>} Picked object
523
+ * @returns {any} Picked object
523
524
  */
524
- static except(value, keys, merge = null)
525
+ static except(value : any, keys : string[], merge : any = null) : any
525
526
  {
526
527
  let result = {};
527
528
 
528
529
  this.each(value, (val, key) => {
529
- if ( ! Arr.has(keys, key) ) result[key] = val;
530
+ if ( !Arr.has(keys, key) ) result[key] = val;
530
531
  });
531
532
 
532
533
  if ( merge == null ) {
@@ -546,13 +547,13 @@ export class PicoObject
546
547
  * @param {any} search Search spec
547
548
  * @returns {boolean} True if includes
548
549
  */
549
- static includes(value, search)
550
+ static includes(value : any, search : any) : boolean
550
551
  {
551
552
  if ( Mix.isArr(search) ) {
552
553
  return Arr.includes(value, search);
553
554
  }
554
555
 
555
- if ( ! Mix.isObj(search) ) {
556
+ if ( !Mix.isObj(search) ) {
556
557
  return value === search;
557
558
  }
558
559
 
@@ -562,7 +563,7 @@ export class PicoObject
562
563
  true, keys.length,
563
564
  ];
564
565
 
565
- for ( let i = 0; result === true && i < length; i++) {
566
+ for ( let i = 0; result === true && i < length; i++ ) {
566
567
  result = this.includes(...[
567
568
  value[keys[i]], search[keys[i]]
568
569
  ]);
@@ -581,13 +582,13 @@ export class PicoObject
581
582
  * @param {any} search Search spec
582
583
  * @returns {boolean} True if matches
583
584
  */
584
- static matches(value, search)
585
+ static matches(value : any, search : any) : boolean
585
586
  {
586
587
  if ( Mix.isArr(search) ) {
587
588
  return Arr.matches(value, search);
588
589
  }
589
590
 
590
- if ( ! Mix.isObj(value) ) {
591
+ if ( !Mix.isObj(value) ) {
591
592
  return value === search;
592
593
  }
593
594
 
@@ -599,7 +600,7 @@ export class PicoObject
599
600
  true, keys.length,
600
601
  ];
601
602
 
602
- for ( let i = 0; result === true && i < length; i++) {
603
+ for ( let i = 0; result === true && i < length; i++ ) {
603
604
  result &&= this.matches(...[
604
605
  value[keys[i]], search[keys[i]]
605
606
  ]);
@@ -608,51 +609,12 @@ export class PicoObject
608
609
  return result;
609
610
  }
610
611
 
611
- static sort(obj, key)
612
+ static sort(value : any, key : string) : any
612
613
  {
613
- let keys = Mix.keys(obj);
614
-
615
- if ( Mix.isFunction(key) ) {
616
- keys = keys.sort((a, b) => {
617
- return key.call({}, obj[a], obj[b]);
618
- });
619
- }
620
-
621
- if ( !Mix.isFunction(key) ) {
622
- keys = keys.sort((a, b) => {
623
- return Mix.integer(this.get(obj[a], key)) - Mix.integer(this.get(obj[b], key));
624
- })
625
- }
626
-
627
- let result = [];
614
+ let result = Arr.sort(value, key);
628
615
 
629
- Arr.each(keys, (key, index) => {
630
- obj[key]['_key'] = key;
631
- result[index] = obj[key];
632
- });
633
-
634
- return result;
635
- }
636
-
637
- static sortString(obj, key)
638
- {
639
- let keys = Mix.keys(obj);
640
-
641
- if ( !Mix.isFunction(key) ) {
642
- keys = keys.sort((a, b) => {
643
-
644
- let va = Mix.string(this.get(obj[a], key)).toLowerCase();
645
- let vb = Mix.string(this.get(obj[b], key)).toLowerCase();
646
-
647
- return (va < vb) ? - 1 : (va > vb) ? 1 : 0;
648
- })
649
- }
650
-
651
- let result = [];
652
-
653
- Arr.each(keys, (key, index) => {
654
- obj[key]['_key'] = key;
655
- result[index] = obj[key];
616
+ Arr.each(result, (val : any, key : any) => {
617
+ value[key]['_key'] = key;
656
618
  });
657
619
 
658
620
  return result;
@@ -660,44 +622,28 @@ export class PicoObject
660
622
 
661
623
  }
662
624
 
663
- /**
664
- * @see PicoMixed.vals
665
- */
666
- PicoObject.values = (...args) => {
625
+ // @ts-ignore
626
+ PicoObject.sortString = (...args : Parameters<typeof PicoObject.sort>) => {
627
+ console.warn('Obj.sortString() is deprecated, use Obj.sort() instead.');
628
+ return PicoObject.sort(...args);
629
+ };
630
+
631
+ // @ts-ignore
632
+ PicoObject.values = (...args : Parameters<typeof Mix.vals>) => {
667
633
  console.warn('Obj.values() is deprecated, use Mix.vals() instead.');
668
634
  return Mix.vals(...args);
669
635
  };
670
636
 
671
- /**
672
- * @see PicoArray.find
673
- */
674
- PicoObject.find = (...args) => {
637
+ // @ts-ignore
638
+ PicoObject.find = (...args : Parameters<typeof Arr.find>) => {
675
639
  console.warn('Obj.find() is deprecated, use Arr.find() instead.');
676
640
  return Arr.find(...args);
677
641
  };
678
642
 
679
- /**
680
- * @see PicoArray.findIndex
681
- */
682
- PicoObject.findIndex = (...args) => {
643
+ // @ts-ignore
644
+ PicoObject.findIndex = (...args : Parameters<typeof Arr.findIndex>) => {
683
645
  console.warn('Obj.findIndex() is deprecated, use Arr.findIndex() instead.');
684
646
  return Arr.findIndex(...args);
685
647
  };
686
648
 
687
- // /**
688
- // * @see PicoArray.sort
689
- // */
690
- // PicoObject.sort = (...args) => {
691
- // console.warn('Obj.sort() is deprecated, use Arr.sort() instead.');
692
- // return Arr.sort(...args);
693
- // };
694
- //
695
- // /**
696
- // * @see PicoArray.sortDeep
697
- // */
698
- // PicoObject.sortString = (...args) => {
699
- // console.warn('Obj.sortString() is deprecated, use Arr.sortDeep() instead.');
700
- // return Arr.sortDeep(...args);
701
- // };
702
-
703
649
  export default PicoObject
@@ -1,9 +1,11 @@
1
- import { Arr, For, Locale, Mix, Obj } from "../index.esm.js";
1
+ import { For, Mix, Obj } from "../index.esm.ts";
2
2
 
3
3
  export class PicoRoute
4
4
  {
5
-
6
- static $routes = {};
5
+ /**
6
+ * @type {any}
7
+ */
8
+ static $routes : any = {};
7
9
 
8
10
  /**
9
11
  * Store route template by key
@@ -14,7 +16,7 @@ export class PicoRoute
14
16
  * @param {string} value Route template
15
17
  * @returns {void} No return value
16
18
  */
17
- static set(key, value)
19
+ static set(key : string, value : string) : void
18
20
  {
19
21
  this.$routes[key] = value;
20
22
  }
@@ -30,19 +32,19 @@ export class PicoRoute
30
32
  * @param {any} [query] Query params
31
33
  * @returns {string} Built url
32
34
  */
33
- static get(key, values = null, query = null)
35
+ static get(key : string, values : any = null, query : any = null) : string
34
36
  {
35
37
  let route = key;
36
38
 
37
- if ( ! /^https?:\/\//.test(route) ) {
39
+ if ( !/^https?:\/\//.test(route) ) {
38
40
  route = this.$routes[key] || key
39
41
  }
40
42
 
41
- Obj.each(values, (val, key) => {
43
+ Obj.each(values, (val : any, key : any) => {
42
44
  route = route.replace(new RegExp('{' + key + '}', 'g'), val);
43
45
  });
44
46
 
45
- if ( ! Mix.isEmpty(query) ) {
47
+ if ( !Mix.isEmpty(query) ) {
46
48
  route += '?' + For.castParams(query);
47
49
  }
48
50
 
@@ -59,7 +61,7 @@ export class PicoRoute
59
61
  * @param {any} [params] Query params
60
62
  * @returns {void} No return value
61
63
  */
62
- static goto(key, values = null, params = null)
64
+ static goto(key : string, values : any = null, params : any = null) : void
63
65
  {
64
66
  window.location.href = this.get(key, values, params);
65
67
  }