@kizmann/pico-js 0.4.6 → 0.4.8
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/dist/pico-js.js +1 -1
- package/dist/pico-js.js.map +1 -1
- package/package.json +1 -1
- package/src/library/map.js +2 -2
- package/src/utility/now.js +17 -14
- package/webpack.config.cjs +5 -5
package/package.json
CHANGED
package/src/library/map.js
CHANGED
@@ -27,7 +27,7 @@ export default class Map
|
|
27
27
|
constructor(el, options = {})
|
28
28
|
{
|
29
29
|
if ( ! global.google ) {
|
30
|
-
|
30
|
+
throw new Error('Google Maps is required for pi.Map');
|
31
31
|
}
|
32
32
|
|
33
33
|
let center = Obj.only(options, ['lat', 'lng']);
|
@@ -52,7 +52,7 @@ export default class Map
|
|
52
52
|
static setMarkerStyle(key, style = {}, extra = {})
|
53
53
|
{
|
54
54
|
if ( ! global.google ) {
|
55
|
-
|
55
|
+
throw new Error('Google Maps is required for pi.Map');
|
56
56
|
}
|
57
57
|
|
58
58
|
if ( ! Obj.has(style, 'default') ) {
|
package/src/utility/now.js
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
import { Num, Arr, Any } from "../index.js";
|
2
|
-
import moment from "moment";
|
3
2
|
|
4
3
|
export class Now
|
5
4
|
{
|
6
5
|
initialDate = null;
|
7
6
|
moment = null;
|
8
7
|
|
9
|
-
constructor(date = null, format = 'YYYY-MM-DD
|
8
|
+
constructor(date = null, format = 'YYYY-MM-DD HH:mm:ss')
|
10
9
|
{
|
10
|
+
if ( ! global.moment ) {
|
11
|
+
throw new Error('Moment.js is required for pi.Now');
|
12
|
+
}
|
13
|
+
|
11
14
|
if ( date instanceof Now ) {
|
12
15
|
date = date.get().toDate();
|
13
16
|
}
|
@@ -15,14 +18,14 @@ export class Now
|
|
15
18
|
this.initialDate = date;
|
16
19
|
|
17
20
|
if ( ! Any.isString(date) ) {
|
18
|
-
this.moment = moment(date || new Date, format);
|
21
|
+
this.moment = global.moment(date || new Date, format);
|
19
22
|
}
|
20
23
|
|
21
24
|
if ( this.moment !== null ) {
|
22
25
|
return this;
|
23
26
|
}
|
24
27
|
|
25
|
-
this.moment = moment(date.match(/^now/) ?
|
28
|
+
this.moment = global.moment(date.match(/^now/) ?
|
26
29
|
new Date : date, format);
|
27
30
|
|
28
31
|
let second = this.initialDate.match(/(\+|-)([0-9]+)seconds?/);
|
@@ -76,7 +79,7 @@ export class Now
|
|
76
79
|
return this;
|
77
80
|
}
|
78
81
|
|
79
|
-
static make(date = null, format = 'YYYY-MM-DD
|
82
|
+
static make(date = null, format = 'YYYY-MM-DD HH:mm:ss')
|
80
83
|
{
|
81
84
|
return new Now(date, format);
|
82
85
|
}
|
@@ -89,7 +92,7 @@ export class Now
|
|
89
92
|
valid()
|
90
93
|
{
|
91
94
|
return ! Any.isEmpty(this.initialDate) &&
|
92
|
-
moment(this.initialDate).isValid();
|
95
|
+
global.moment(this.initialDate).isValid();
|
93
96
|
}
|
94
97
|
|
95
98
|
clone()
|
@@ -102,7 +105,7 @@ export class Now
|
|
102
105
|
return Num.int(this.format(format, true));
|
103
106
|
}
|
104
107
|
|
105
|
-
format(format = 'YYYY-MM-DD
|
108
|
+
format(format = 'YYYY-MM-DD HH:mm:ss', force = false)
|
106
109
|
{
|
107
110
|
if ( ! this.valid() && ! force ) {
|
108
111
|
return '';
|
@@ -124,8 +127,8 @@ export class Now
|
|
124
127
|
|
125
128
|
beforeTime(before = null)
|
126
129
|
{
|
127
|
-
return this.code('
|
128
|
-
Now.make(before).code('
|
130
|
+
return this.code('HHmmss') <
|
131
|
+
Now.make(before).code('HHmmss');
|
129
132
|
}
|
130
133
|
|
131
134
|
after(after = null)
|
@@ -141,8 +144,8 @@ export class Now
|
|
141
144
|
|
142
145
|
afterTime(after = null)
|
143
146
|
{
|
144
|
-
return this.code('
|
145
|
-
Now.make(after).code('
|
147
|
+
return this.code('HHmmss') >
|
148
|
+
Now.make(after).code('HHmmss');
|
146
149
|
}
|
147
150
|
|
148
151
|
equal(equal = null, format = 'X')
|
@@ -156,7 +159,7 @@ export class Now
|
|
156
159
|
return this.equal(equal, format);
|
157
160
|
}
|
158
161
|
|
159
|
-
equalTime(equal = null, format = '
|
162
|
+
equalTime(equal = null, format = 'HHmmss')
|
160
163
|
{
|
161
164
|
return this.equal(equal, format);
|
162
165
|
}
|
@@ -516,7 +519,7 @@ export class Now
|
|
516
519
|
return this;
|
517
520
|
}
|
518
521
|
|
519
|
-
applyDate(now, format = 'YYYY-MM-DD
|
522
|
+
applyDate(now, format = 'YYYY-MM-DD HH:mm:ss')
|
520
523
|
{
|
521
524
|
now = Now.make(now, format);
|
522
525
|
|
@@ -525,7 +528,7 @@ export class Now
|
|
525
528
|
this.date(now.date());
|
526
529
|
}
|
527
530
|
|
528
|
-
applyTime(now, format = 'YYYY-MM-DD
|
531
|
+
applyTime(now, format = 'YYYY-MM-DD HH:mm:ss')
|
529
532
|
{
|
530
533
|
now = Now.make(now, format);
|
531
534
|
|
package/webpack.config.cjs
CHANGED
@@ -18,11 +18,11 @@ let config = {
|
|
18
18
|
}
|
19
19
|
]
|
20
20
|
},
|
21
|
-
externals: {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
},
|
21
|
+
// externals: {
|
22
|
+
// 'moment': {
|
23
|
+
// root: 'moment', commonjs2: 'moment', commonjs: 'moment', amd: 'moment'
|
24
|
+
// },
|
25
|
+
// },
|
26
26
|
plugins: []
|
27
27
|
};
|
28
28
|
|