@kizmann/pico-js 0.4.1 → 0.4.4

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.4.1",
3
+ "version": "0.4.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -2,7 +2,7 @@ import { Arr, Obj, Num, Any, Event } from "../index.js";
2
2
 
3
3
  export class Data
4
4
  {
5
- static data = Obj.get(window, '_data', {});
5
+ static data = Obj.get(global, '_data', {});
6
6
 
7
7
  static has(input)
8
8
  {
@@ -5,7 +5,7 @@ export class Locale
5
5
  /**
6
6
  * Get locales from window if present.
7
7
  */
8
- static locales = Obj.get(window, '_locales', {});
8
+ static locales = Obj.get(global, '_locales', {});
9
9
 
10
10
  static pickByCount(splits, count)
11
11
  {
@@ -2,7 +2,7 @@ import { Obj, Str, Any } from "../index.js";
2
2
 
3
3
  export default class Route
4
4
  {
5
- static routes = Obj.get(window, '_routes', {});
5
+ static routes = Obj.get(global, '_routes', {});
6
6
 
7
7
  static set (key, value)
8
8
  {
@@ -507,6 +507,33 @@ export class Now
507
507
  });
508
508
  }
509
509
 
510
+ resetTime()
511
+ {
512
+ this.hour(0);
513
+ this.minute(0);
514
+ this.second(0);
515
+
516
+ return this;
517
+ }
518
+
519
+ applyDate(now, format = 'YYYY-MM-DD hh:mm:ss')
520
+ {
521
+ now = Now.make(now, format);
522
+
523
+ this.year(now.year());
524
+ this.month(now.month());
525
+ this.date(now.date());
526
+ }
527
+
528
+ applyTime(now, format = 'YYYY-MM-DD hh:mm:ss')
529
+ {
530
+ now = Now.make(now, format);
531
+
532
+ this.hour(now.hour());
533
+ this.minute(now.minute());
534
+ this.second(now.second());
535
+ }
536
+
510
537
  }
511
538
 
512
539
  export default Now;
@@ -345,7 +345,7 @@ export class Obj
345
345
  {
346
346
  let result = {};
347
347
 
348
- if ( obj instanceof FormData ) {
348
+ if ( global.FormData && obj instanceof FormData ) {
349
349
 
350
350
  for ( let [key, value] of obj.entries() ) {
351
351
  result[key] = callback(value, key);