@kizmann/pico-js 0.4.6 → 0.4.7

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.6",
3
+ "version": "0.4.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -27,7 +27,7 @@ export default class Map
27
27
  constructor(el, options = {})
28
28
  {
29
29
  if ( ! global.google ) {
30
- return console.error('Google Maps is not loaded.');
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
- return console.error('Google Maps is not loaded.');
55
+ throw new Error('Google Maps is required for pi.Map');
56
56
  }
57
57
 
58
58
  if ( ! Obj.has(style, 'default') ) {
@@ -1,5 +1,4 @@
1
1
  import { Num, Arr, Any } from "../index.js";
2
- import moment from "moment";
3
2
 
4
3
  export class Now
5
4
  {
@@ -8,6 +7,10 @@ export class Now
8
7
 
9
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?/);
@@ -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()
@@ -18,11 +18,11 @@ let config = {
18
18
  }
19
19
  ]
20
20
  },
21
- externals: {
22
- 'moment': {
23
- root: 'moment', commonjs2: 'moment', commonjs: 'moment', amd: 'moment'
24
- },
25
- },
21
+ // externals: {
22
+ // 'moment': {
23
+ // root: 'moment', commonjs2: 'moment', commonjs: 'moment', amd: 'moment'
24
+ // },
25
+ // },
26
26
  plugins: []
27
27
  };
28
28