vdrag-topo-utils 1.1.0 → 1.2.0

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/es/index.js CHANGED
@@ -1,72 +1,71 @@
1
1
  import { default as r } from "./src/withinstall.js";
2
2
  import { default as a } from "./src/bus.js";
3
- import { UA as l, _global as m, _support as s, addEventListenter as n, customizeSetInterval as p, debounce as d, getClientHeight as g, getGlobal as f, getGlobalSupport as c, getLocationHref as x, getScrollHeight as S, getScrollTop as h, getUrlParam as u, htmlElementAsString as v, inBrowser as D, is360zhushou as E, isAndroid as b, isChrome as T, isEdge as y, isIE as B, isIE9 as I, isIOS as U, isMobile as w, isWeiXin as F, matchUrlFileName as H, nativeTryCatch as _, parseUrlToObj as A, supportsHistory as C, throttle as L, throttle_02 as P } from "./src/browser.js";
4
- import { addBigBraceToStr as z, addMiddleBraceToStr as G, extractStrFromCurlyBrace as N, extractStrFromMiddleBrace as O, interceptStr as j, unknownToString as k, validateEmail as W, validateFixedPhone as X, validatePhone as q, validateSpecialString_01 as J } from "./src/string.js";
5
- import { formatDate as Q, formatDate_02 as R, generateUUID as V, getDaysDiffBetweenDates as Y, getDaysDiffFromNow as Z, getTimestamp as $ } from "./src/time.js";
6
- import { isExistProperty as te, variableTypeDetection as re } from "./src/type.js";
7
- import { replaceAop as ae } from "./src/object.js";
8
- import { fromHttpStatus as le } from "./src/http.js";
9
- import { addEventListener as se, removeEventListener as ne, triggerDragEvent as pe } from "./src/dom.js";
10
- import { formatDecimal as ge, random as fe } from "./src/number.js";
11
- import { imgError as xe, preloadImage as Se } from "./src/image.js";
3
+ import { UA as l, _global as m, _support as s, customizeSetInterval as n, debounce as p, getClientHeight as g, getGlobal as d, getGlobalSupport as f, getLocationHref as c, getScrollHeight as x, getScrollTop as S, getUrlParam as h, htmlElementAsString as u, inBrowser as v, is360zhushou as D, isAndroid as E, isChrome as b, isEdge as T, isIE as y, isIE9 as B, isIOS as I, isMobile as U, isWeiXin as w, matchUrlFileName as F, nativeTryCatch as H, parseUrlToObj as _, supportsHistory as A, throttle as C, throttle_02 as P } from "./src/browser.js";
4
+ import { addBigBraceToStr as M, addMiddleBraceToStr as z, extractStrFromCurlyBrace as G, extractStrFromMiddleBrace as N, interceptStr as O, unknownToString as j, validateEmail as k, validateFixedPhone as W, validatePhone as X, validateSpecialString_01 as q } from "./src/string.js";
5
+ import { formatDate as K, formatDate_02 as Q, generateUUID as R, getDaysDiffBetweenDates as V, getDaysDiffFromNow as Y, getTimestamp as Z } from "./src/time.js";
6
+ import { isExistProperty as ee, variableTypeDetection as te } from "./src/type.js";
7
+ import { replaceAop as oe } from "./src/object.js";
8
+ import { fromHttpStatus as ie } from "./src/http.js";
9
+ import { addEventListener as me, removeEventListener as se, triggerDragEvent as ne } from "./src/dom.js";
10
+ import { formatDecimal as ge, random as de } from "./src/number.js";
11
+ import { imgError as ce, preloadImage as xe } from "./src/image.js";
12
12
  export {
13
13
  l as UA,
14
14
  m as _global,
15
15
  s as _support,
16
- z as addBigBraceToStr,
17
- se as addEventListener,
18
- n as addEventListenter,
19
- G as addMiddleBraceToStr,
16
+ M as addBigBraceToStr,
17
+ me as addEventListener,
18
+ z as addMiddleBraceToStr,
20
19
  a as bus,
21
- p as customizeSetInterval,
22
- d as debounce,
23
- N as extractStrFromCurlyBrace,
24
- O as extractStrFromMiddleBrace,
25
- Q as formatDate,
26
- R as formatDate_02,
20
+ n as customizeSetInterval,
21
+ p as debounce,
22
+ G as extractStrFromCurlyBrace,
23
+ N as extractStrFromMiddleBrace,
24
+ K as formatDate,
25
+ Q as formatDate_02,
27
26
  ge as formatDecimal,
28
- le as fromHttpStatus,
29
- V as generateUUID,
27
+ ie as fromHttpStatus,
28
+ R as generateUUID,
30
29
  g as getClientHeight,
31
- Y as getDaysDiffBetweenDates,
32
- Z as getDaysDiffFromNow,
33
- f as getGlobal,
34
- c as getGlobalSupport,
35
- x as getLocationHref,
36
- S as getScrollHeight,
37
- h as getScrollTop,
38
- $ as getTimestamp,
39
- u as getUrlParam,
40
- v as htmlElementAsString,
41
- xe as imgError,
42
- D as inBrowser,
43
- j as interceptStr,
44
- E as is360zhushou,
45
- b as isAndroid,
46
- T as isChrome,
47
- y as isEdge,
48
- te as isExistProperty,
49
- B as isIE,
50
- I as isIE9,
51
- U as isIOS,
52
- w as isMobile,
53
- F as isWeiXin,
54
- H as matchUrlFileName,
55
- _ as nativeTryCatch,
56
- A as parseUrlToObj,
57
- Se as preloadImage,
58
- fe as random,
59
- ne as removeEventListener,
60
- ae as replaceAop,
61
- C as supportsHistory,
62
- L as throttle,
30
+ V as getDaysDiffBetweenDates,
31
+ Y as getDaysDiffFromNow,
32
+ d as getGlobal,
33
+ f as getGlobalSupport,
34
+ c as getLocationHref,
35
+ x as getScrollHeight,
36
+ S as getScrollTop,
37
+ Z as getTimestamp,
38
+ h as getUrlParam,
39
+ u as htmlElementAsString,
40
+ ce as imgError,
41
+ v as inBrowser,
42
+ O as interceptStr,
43
+ D as is360zhushou,
44
+ E as isAndroid,
45
+ b as isChrome,
46
+ T as isEdge,
47
+ ee as isExistProperty,
48
+ y as isIE,
49
+ B as isIE9,
50
+ I as isIOS,
51
+ U as isMobile,
52
+ w as isWeiXin,
53
+ F as matchUrlFileName,
54
+ H as nativeTryCatch,
55
+ _ as parseUrlToObj,
56
+ xe as preloadImage,
57
+ de as random,
58
+ se as removeEventListener,
59
+ oe as replaceAop,
60
+ A as supportsHistory,
61
+ C as throttle,
63
62
  P as throttle_02,
64
- pe as triggerDragEvent,
65
- k as unknownToString,
66
- W as validateEmail,
67
- X as validateFixedPhone,
68
- q as validatePhone,
69
- J as validateSpecialString_01,
70
- re as variableTypeDetection,
63
+ ne as triggerDragEvent,
64
+ j as unknownToString,
65
+ k as validateEmail,
66
+ W as validateFixedPhone,
67
+ X as validatePhone,
68
+ q as validateSpecialString_01,
69
+ te as variableTypeDetection,
71
70
  r as withInstall
72
71
  };
@@ -1,4 +1,4 @@
1
- import { Callback, Window } from "../types";
1
+ import { Window } from "../types";
2
2
  export declare const inBrowser: boolean;
3
3
  export declare const UA: any;
4
4
  export declare const isIE: any;
@@ -14,14 +14,6 @@ export declare const is360zhushou: any;
14
14
  * @returns
15
15
  */
16
16
  export declare const isMobile: () => any;
17
- /**
18
- * 给节点添加监听事件
19
- * @param target
20
- * @param eventName
21
- * @param handler
22
- * @param options
23
- */
24
- export declare function addEventListenter(target: any, eventName: string, handler: Callback, options?: boolean): void;
25
17
  /**
26
18
  * 获取全局事件
27
19
  * @returns window
@@ -1,16 +1,13 @@
1
- const f = typeof window < "u", r = f && window.navigator.userAgent.toLowerCase(), y = r && /msie|trident/.test(r), w = r && r.indexOf("msie 9.0") > 0, p = r && r.indexOf("edge/") > 0, T = r && r.indexOf("android") > 0, b = r && /iphone|ipad|ipod|ios/.test(r), E = r && /chrome\/\d+/.test(r) && !p, H = r && /micromessenger/.test(r), _ = r && /360appstore/.test(r), x = () => r.match(
1
+ const f = typeof window < "u", r = f && window.navigator.userAgent.toLowerCase(), y = r && /msie|trident/.test(r), w = r && r.indexOf("msie 9.0") > 0, p = r && r.indexOf("edge/") > 0, T = r && r.indexOf("android") > 0, b = r && /iphone|ipad|ipod|ios/.test(r), H = r && /chrome\/\d+/.test(r) && !p, E = r && /micromessenger/.test(r), _ = r && /360appstore/.test(r), x = () => r.match(
2
2
  /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
3
3
  );
4
- function S(t, e, n, o = !1) {
5
- t.addEventListener(e, n, o);
6
- }
7
4
  function h() {
8
5
  return window;
9
6
  }
10
7
  function g() {
11
8
  return m.__vdrag_topo_error__ || {};
12
9
  }
13
- const m = h(), v = g();
10
+ const m = h(), S = g();
14
11
  function A(t, e) {
15
12
  try {
16
13
  t();
@@ -18,21 +15,21 @@ function A(t, e) {
18
15
  e && e(n);
19
16
  }
20
17
  }
21
- function O() {
18
+ function v() {
22
19
  return typeof document > "u" || document.location == null ? "" : document.location.href;
23
20
  }
24
- function $(t, e = ".js") {
21
+ function O(t, e = ".js") {
25
22
  if (t.endsWith(e))
26
23
  return t.substring(t.lastIndexOf("/") + 1);
27
24
  }
28
- function C(t, e = window.location.href) {
25
+ function $(t, e = window.location.href) {
29
26
  const n = decodeURI(e), o = {}, i = n.split("?").length > 1 ? n.split("?")[1] : null;
30
27
  return i ? (i.split("&").forEach(function(c) {
31
28
  const [l, a] = c.split("=");
32
29
  o[l] = a;
33
30
  }), o[t]) : null;
34
31
  }
35
- function D(t) {
32
+ function C(t) {
36
33
  if (!t)
37
34
  return {};
38
35
  const e = t.match(
@@ -49,7 +46,7 @@ function D(t) {
49
46
  relative: e[5] + n + o
50
47
  };
51
48
  }
52
- function I(t) {
49
+ function D(t) {
53
50
  const e = t.tagName.toLowerCase();
54
51
  if (e === "body")
55
52
  return "";
@@ -58,14 +55,14 @@ function I(t) {
58
55
  const o = t.id ? ` id="${t.id}"` : "", i = t.innerText;
59
56
  return `<${e}${o}${n !== "" ? n : ""}>${i}</${e}>`;
60
57
  }
61
- const M = (t, e) => {
58
+ const I = (t, e) => {
62
59
  let n = !0;
63
60
  return function(...o) {
64
61
  n && (t.apply(this, o), n = !1, setTimeout(() => {
65
62
  n = !0;
66
63
  }, e));
67
64
  };
68
- }, B = function(t, e, n) {
65
+ }, M = function(t, e, n) {
69
66
  let o, i, s, c, l;
70
67
  const a = function() {
71
68
  const u = (/* @__PURE__ */ new Date()).getTime() - c;
@@ -76,7 +73,7 @@ const M = (t, e) => {
76
73
  const u = n && !o;
77
74
  return o || (o = setTimeout(a, e)), u && (l = t.apply(s, i), s = i = null), l;
78
75
  };
79
- }, L = function(t, e, n) {
76
+ }, B = function(t, e, n) {
80
77
  let o, i, s, c = null, l = 0;
81
78
  n || (n = {});
82
79
  const a = function() {
@@ -105,11 +102,11 @@ const P = () => {
105
102
  document.body.clientHeight,
106
103
  document.documentElement.clientHeight
107
104
  ), t;
108
- }, W = () => Math.max(
105
+ }, L = () => Math.max(
109
106
  document.body.scrollHeight,
110
107
  document.documentElement.scrollHeight
111
108
  );
112
- function k(t, e) {
109
+ function W(t, e) {
113
110
  let n = Date.now(), o = 0;
114
111
  const i = () => {
115
112
  let s = Date.now();
@@ -120,32 +117,31 @@ function k(t, e) {
120
117
  export {
121
118
  r as UA,
122
119
  m as _global,
123
- v as _support,
124
- S as addEventListenter,
125
- k as customizeSetInterval,
126
- B as debounce,
120
+ S as _support,
121
+ W as customizeSetInterval,
122
+ M as debounce,
127
123
  U as getClientHeight,
128
124
  h as getGlobal,
129
125
  g as getGlobalSupport,
130
- O as getLocationHref,
131
- W as getScrollHeight,
126
+ v as getLocationHref,
127
+ L as getScrollHeight,
132
128
  P as getScrollTop,
133
- C as getUrlParam,
134
- I as htmlElementAsString,
129
+ $ as getUrlParam,
130
+ D as htmlElementAsString,
135
131
  f as inBrowser,
136
132
  _ as is360zhushou,
137
133
  T as isAndroid,
138
- E as isChrome,
134
+ H as isChrome,
139
135
  p as isEdge,
140
136
  y as isIE,
141
137
  w as isIE9,
142
138
  b as isIOS,
143
139
  x as isMobile,
144
- H as isWeiXin,
145
- $ as matchUrlFileName,
140
+ E as isWeiXin,
141
+ O as matchUrlFileName,
146
142
  A as nativeTryCatch,
147
- D as parseUrlToObj,
143
+ C as parseUrlToObj,
148
144
  N as supportsHistory,
149
- M as throttle,
150
- L as throttle_02
145
+ I as throttle,
146
+ B as throttle_02
151
147
  };
@@ -1,2 +1,5 @@
1
1
  import { SpanStatus } from "../types/index";
2
+ /**
3
+ * http请求的状态码进行转换
4
+ */
2
5
  export declare function fromHttpStatus(httpStatus: any): SpanStatus.Ok | SpanStatus.DeadlineExceeded | SpanStatus.Unauthenticated | SpanStatus.PermissionDenied | SpanStatus.NotFound | SpanStatus.ResourceExhausted | SpanStatus.InvalidArgument | SpanStatus.Unimplemented | SpanStatus.Unavailable | SpanStatus.InternalError | SpanStatus.UnknownError | SpanStatus.AlreadyExists | SpanStatus.FailedPrecondition;
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * img获取404时,设置默认的图片
3
+ * @param event
4
+ * @param defaultImage
3
5
  */
4
6
  export declare function imgError(event: any, defaultImage: string): void;
5
7
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * unknown转成自负出啊
2
+ * unknown转成字符串
3
3
  * @param target
4
4
  * @returns
5
5
  */
@@ -48,7 +48,7 @@ export declare function addBigBraceToStr(str: string): string;
48
48
  */
49
49
  export declare function validateEmail(str: string): boolean;
50
50
  /**
51
- * 验证固定电话
51
+ * 验证手机号
52
52
  * @param num
53
53
  * @returns
54
54
  */
@@ -9,11 +9,11 @@ export declare function getTimestamp(): number;
9
9
  * @param {number} timestamp - 时间戳
10
10
  * @return {string}
11
11
  */
12
- export declare const formatDate: (format?: string, timestamp?: number) => string;
12
+ export declare const formatDate: (timestamp?: number, format?: string) => string;
13
13
  /**
14
- * 时间格式化为两位数
14
+ * 数值格式化为两位数
15
15
  * @author beth
16
- * @DateTime 2020-05-22
16
+ * @DateTime 5 => 05
17
17
  * @return {Number} s
18
18
  */
19
19
  export declare const formatDate_02: (str: string) => string;
@@ -1,8 +1,8 @@
1
1
  function c() {
2
2
  return Date.now();
3
3
  }
4
- const D = (e = "Y-M-D h:m:s", a = Date.now()) => {
5
- const n = new Date(a || Date.now()), t = {
4
+ const D = (e = Date.now(), a = "Y-M-D h:m:s") => {
5
+ const n = new Date(e || Date.now()), t = {
6
6
  Y: `${n.getFullYear()}`,
7
7
  M: `${n.getMonth() + 1}`,
8
8
  D: `${n.getDate()}`,
@@ -10,7 +10,7 @@ const D = (e = "Y-M-D h:m:s", a = Date.now()) => {
10
10
  m: n.getMinutes(),
11
11
  s: n.getSeconds()
12
12
  }, o = (r) => r > 10 ? r : "0" + r;
13
- return (e || "Y-M-D h:m:s").replace("Y", t.Y).replace("M", t.M).replace("D", t.D).replace("h", o(t.h)).replace("m", o(t.m)).replace("s", o(t.s));
13
+ return (a || "Y-M-D h:m:s").replace("Y", t.Y).replace("M", t.M).replace("D", t.D).replace("h", o(t.h)).replace("m", o(t.m)).replace("s", o(t.s));
14
14
  }, s = (e) => Number(e) >= 10 ? e : "0" + e;
15
15
  function u() {
16
16
  let e = (/* @__PURE__ */ new Date()).getTime();
@@ -1,3 +1,6 @@
1
+ /**
2
+ * 判断变量的类型
3
+ */
1
4
  export declare const variableTypeDetection: {
2
5
  isNumber: (value: any) => boolean;
3
6
  isString: (value: any) => boolean;
package/dist/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./src/withinstall.js"),s=require("./src/bus.js"),e=require("./src/browser.js"),t=require("./src/string.js"),r=require("./src/time.js"),a=require("./src/type.js"),g=require("./src/object.js"),c=require("./src/http.js"),i=require("./src/dom.js"),o=require("./src/number.js"),l=require("./src/image.js");exports.withInstall=n;exports.bus=s;exports.UA=e.UA;exports._global=e._global;exports._support=e._support;exports.addEventListenter=e.addEventListenter;exports.customizeSetInterval=e.customizeSetInterval;exports.debounce=e.debounce;exports.getClientHeight=e.getClientHeight;exports.getGlobal=e.getGlobal;exports.getGlobalSupport=e.getGlobalSupport;exports.getLocationHref=e.getLocationHref;exports.getScrollHeight=e.getScrollHeight;exports.getScrollTop=e.getScrollTop;exports.getUrlParam=e.getUrlParam;exports.htmlElementAsString=e.htmlElementAsString;exports.inBrowser=e.inBrowser;exports.is360zhushou=e.is360zhushou;exports.isAndroid=e.isAndroid;exports.isChrome=e.isChrome;exports.isEdge=e.isEdge;exports.isIE=e.isIE;exports.isIE9=e.isIE9;exports.isIOS=e.isIOS;exports.isMobile=e.isMobile;exports.isWeiXin=e.isWeiXin;exports.matchUrlFileName=e.matchUrlFileName;exports.nativeTryCatch=e.nativeTryCatch;exports.parseUrlToObj=e.parseUrlToObj;exports.supportsHistory=e.supportsHistory;exports.throttle=e.throttle;exports.throttle_02=e.throttle_02;exports.addBigBraceToStr=t.addBigBraceToStr;exports.addMiddleBraceToStr=t.addMiddleBraceToStr;exports.extractStrFromCurlyBrace=t.extractStrFromCurlyBrace;exports.extractStrFromMiddleBrace=t.extractStrFromMiddleBrace;exports.interceptStr=t.interceptStr;exports.unknownToString=t.unknownToString;exports.validateEmail=t.validateEmail;exports.validateFixedPhone=t.validateFixedPhone;exports.validatePhone=t.validatePhone;exports.validateSpecialString_01=t.validateSpecialString_01;exports.formatDate=r.formatDate;exports.formatDate_02=r.formatDate_02;exports.generateUUID=r.generateUUID;exports.getDaysDiffBetweenDates=r.getDaysDiffBetweenDates;exports.getDaysDiffFromNow=r.getDaysDiffFromNow;exports.getTimestamp=r.getTimestamp;exports.isExistProperty=a.isExistProperty;exports.variableTypeDetection=a.variableTypeDetection;exports.replaceAop=g.replaceAop;exports.fromHttpStatus=c.fromHttpStatus;exports.addEventListener=i.addEventListener;exports.removeEventListener=i.removeEventListener;exports.triggerDragEvent=i.triggerDragEvent;exports.formatDecimal=o.formatDecimal;exports.random=o.random;exports.imgError=l.imgError;exports.preloadImage=l.preloadImage;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./src/withinstall.js"),n=require("./src/bus.js"),e=require("./src/browser.js"),t=require("./src/string.js"),r=require("./src/time.js"),a=require("./src/type.js"),g=require("./src/object.js"),c=require("./src/http.js"),i=require("./src/dom.js"),o=require("./src/number.js"),l=require("./src/image.js");exports.withInstall=s;exports.bus=n;exports.UA=e.UA;exports._global=e._global;exports._support=e._support;exports.customizeSetInterval=e.customizeSetInterval;exports.debounce=e.debounce;exports.getClientHeight=e.getClientHeight;exports.getGlobal=e.getGlobal;exports.getGlobalSupport=e.getGlobalSupport;exports.getLocationHref=e.getLocationHref;exports.getScrollHeight=e.getScrollHeight;exports.getScrollTop=e.getScrollTop;exports.getUrlParam=e.getUrlParam;exports.htmlElementAsString=e.htmlElementAsString;exports.inBrowser=e.inBrowser;exports.is360zhushou=e.is360zhushou;exports.isAndroid=e.isAndroid;exports.isChrome=e.isChrome;exports.isEdge=e.isEdge;exports.isIE=e.isIE;exports.isIE9=e.isIE9;exports.isIOS=e.isIOS;exports.isMobile=e.isMobile;exports.isWeiXin=e.isWeiXin;exports.matchUrlFileName=e.matchUrlFileName;exports.nativeTryCatch=e.nativeTryCatch;exports.parseUrlToObj=e.parseUrlToObj;exports.supportsHistory=e.supportsHistory;exports.throttle=e.throttle;exports.throttle_02=e.throttle_02;exports.addBigBraceToStr=t.addBigBraceToStr;exports.addMiddleBraceToStr=t.addMiddleBraceToStr;exports.extractStrFromCurlyBrace=t.extractStrFromCurlyBrace;exports.extractStrFromMiddleBrace=t.extractStrFromMiddleBrace;exports.interceptStr=t.interceptStr;exports.unknownToString=t.unknownToString;exports.validateEmail=t.validateEmail;exports.validateFixedPhone=t.validateFixedPhone;exports.validatePhone=t.validatePhone;exports.validateSpecialString_01=t.validateSpecialString_01;exports.formatDate=r.formatDate;exports.formatDate_02=r.formatDate_02;exports.generateUUID=r.generateUUID;exports.getDaysDiffBetweenDates=r.getDaysDiffBetweenDates;exports.getDaysDiffFromNow=r.getDaysDiffFromNow;exports.getTimestamp=r.getTimestamp;exports.isExistProperty=a.isExistProperty;exports.variableTypeDetection=a.variableTypeDetection;exports.replaceAop=g.replaceAop;exports.fromHttpStatus=c.fromHttpStatus;exports.addEventListener=i.addEventListener;exports.removeEventListener=i.removeEventListener;exports.triggerDragEvent=i.triggerDragEvent;exports.formatDecimal=o.formatDecimal;exports.random=o.random;exports.imgError=l.imgError;exports.preloadImage=l.preloadImage;
@@ -1,4 +1,4 @@
1
- import { Callback, Window } from "../types";
1
+ import { Window } from "../types";
2
2
  export declare const inBrowser: boolean;
3
3
  export declare const UA: any;
4
4
  export declare const isIE: any;
@@ -14,14 +14,6 @@ export declare const is360zhushou: any;
14
14
  * @returns
15
15
  */
16
16
  export declare const isMobile: () => any;
17
- /**
18
- * 给节点添加监听事件
19
- * @param target
20
- * @param eventName
21
- * @param handler
22
- * @param options
23
- */
24
- export declare function addEventListenter(target: any, eventName: string, handler: Callback, options?: boolean): void;
25
17
  /**
26
18
  * 获取全局事件
27
19
  * @returns window
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=typeof window<"u",r=f&&window.navigator.userAgent.toLowerCase(),y=r&&/msie|trident/.test(r),b=r&&r.indexOf("msie 9.0")>0,h=r&&r.indexOf("edge/")>0,w=r&&r.indexOf("android")>0,T=r&&/iphone|ipad|ipod|ios/.test(r),E=r&&/chrome\/\d+/.test(r)&&!h,S=r&&/micromessenger/.test(r),H=r&&/360appstore/.test(r),_=()=>r.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);function v(t,e,n,o=!1){t.addEventListener(e,n,o)}function p(){return window}function g(){return m.__vdrag_topo_error__||{}}const m=p(),A=g();function I(t,e){try{t()}catch(n){e&&e(n)}}function O(){return typeof document>"u"||document.location==null?"":document.location.href}function x(t,e=".js"){if(t.endsWith(e))return t.substring(t.lastIndexOf("/")+1)}function C(t,e=window.location.href){const n=decodeURI(e),o={},i=n.split("?").length>1?n.split("?")[1]:null;return i?(i.split("&").forEach(function(l){const[c,a]=l.split("=");o[c]=a}),o[t]):null}function U(t){if(!t)return{};const e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",o=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+o}}function M(t){const e=t.tagName.toLowerCase();if(e==="body")return"";let n=t.classList.value;n=n!==""?` class='${n}'`:"";const o=t.id?` id="${t.id}"`:"",i=t.innerText;return`<${e}${o}${n!==""?n:""}>${i}</${e}>`}const L=(t,e)=>{let n=!0;return function(...o){n&&(t.apply(this,o),n=!1,setTimeout(()=>{n=!0},e))}},P=function(t,e,n){let o,i,s,l,c;const a=function(){const u=new Date().getTime()-l;u<e&&u>=0?o=setTimeout(a,e-u):(o=null,n||(c=t.apply(s,i),o||(s=i=null)))};return function(){s=this,i=arguments,l=new Date().getTime();const u=n&&!o;return o||(o=setTimeout(a,e)),u&&(c=t.apply(s,i),s=i=null),c}},$=function(t,e,n){let o,i,s,l=null,c=0;n||(n={});const a=function(){c=n.leading===!1?0:new Date().getTime(),l=null,s=t.apply(o,i),l||(o=i=null)};return function(){const u=new Date().getTime();!c&&n.leading===!1&&(c=u);const d=e-(u-c);return o=this,i=arguments,d<=0||d>e?(l&&(clearTimeout(l),l=null),c=u,s=t.apply(o,i),l||(o=i=null)):!l&&n.trailing!==!1&&(l=setTimeout(a,d)),s}};function B(){const t=m.chrome,e=t&&t.app&&t.app.runtime,n="history"in m&&!!m.history.pushState&&!!m.history.replaceState;return!e&&n}const D=()=>{let t=0;return document.documentElement&&document.documentElement.scrollTop?t=document.documentElement.scrollTop:document.body&&(t=document.body.scrollTop),t},N=()=>{let t=0;return document.body.clientHeight&&document.documentElement.clientHeight?t=Math.min(document.body.clientHeight,document.documentElement.clientHeight):t=Math.max(document.body.clientHeight,document.documentElement.clientHeight),t},G=()=>Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);function W(t,e){let n=Date.now(),o=0;const i=()=>{let s=Date.now();s-n>=e&&(n=s=Date.now(),t()),cancelAnimationFrame(o),o=window.requestAnimationFrame(i)};return i(),o}exports.UA=r;exports._global=m;exports._support=A;exports.addEventListenter=v;exports.customizeSetInterval=W;exports.debounce=P;exports.getClientHeight=N;exports.getGlobal=p;exports.getGlobalSupport=g;exports.getLocationHref=O;exports.getScrollHeight=G;exports.getScrollTop=D;exports.getUrlParam=C;exports.htmlElementAsString=M;exports.inBrowser=f;exports.is360zhushou=H;exports.isAndroid=w;exports.isChrome=E;exports.isEdge=h;exports.isIE=y;exports.isIE9=b;exports.isIOS=T;exports.isMobile=_;exports.isWeiXin=S;exports.matchUrlFileName=x;exports.nativeTryCatch=I;exports.parseUrlToObj=U;exports.supportsHistory=B;exports.throttle=L;exports.throttle_02=$;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=typeof window<"u",r=f&&window.navigator.userAgent.toLowerCase(),y=r&&/msie|trident/.test(r),b=r&&r.indexOf("msie 9.0")>0,h=r&&r.indexOf("edge/")>0,w=r&&r.indexOf("android")>0,T=r&&/iphone|ipad|ipod|ios/.test(r),S=r&&/chrome\/\d+/.test(r)&&!h,H=r&&/micromessenger/.test(r),E=r&&/360appstore/.test(r),_=()=>r.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);function p(){return window}function g(){return m.__vdrag_topo_error__||{}}const m=p(),A=g();function v(t,e){try{t()}catch(n){e&&e(n)}}function I(){return typeof document>"u"||document.location==null?"":document.location.href}function O(t,e=".js"){if(t.endsWith(e))return t.substring(t.lastIndexOf("/")+1)}function x(t,e=window.location.href){const n=decodeURI(e),o={},i=n.split("?").length>1?n.split("?")[1]:null;return i?(i.split("&").forEach(function(s){const[c,a]=s.split("=");o[c]=a}),o[t]):null}function C(t){if(!t)return{};const e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",o=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+o}}function U(t){const e=t.tagName.toLowerCase();if(e==="body")return"";let n=t.classList.value;n=n!==""?` class='${n}'`:"";const o=t.id?` id="${t.id}"`:"",i=t.innerText;return`<${e}${o}${n!==""?n:""}>${i}</${e}>`}const M=(t,e)=>{let n=!0;return function(...o){n&&(t.apply(this,o),n=!1,setTimeout(()=>{n=!0},e))}},P=function(t,e,n){let o,i,l,s,c;const a=function(){const u=new Date().getTime()-s;u<e&&u>=0?o=setTimeout(a,e-u):(o=null,n||(c=t.apply(l,i),o||(l=i=null)))};return function(){l=this,i=arguments,s=new Date().getTime();const u=n&&!o;return o||(o=setTimeout(a,e)),u&&(c=t.apply(l,i),l=i=null),c}},$=function(t,e,n){let o,i,l,s=null,c=0;n||(n={});const a=function(){c=n.leading===!1?0:new Date().getTime(),s=null,l=t.apply(o,i),s||(o=i=null)};return function(){const u=new Date().getTime();!c&&n.leading===!1&&(c=u);const d=e-(u-c);return o=this,i=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),c=u,l=t.apply(o,i),s||(o=i=null)):!s&&n.trailing!==!1&&(s=setTimeout(a,d)),l}};function B(){const t=m.chrome,e=t&&t.app&&t.app.runtime,n="history"in m&&!!m.history.pushState&&!!m.history.replaceState;return!e&&n}const D=()=>{let t=0;return document.documentElement&&document.documentElement.scrollTop?t=document.documentElement.scrollTop:document.body&&(t=document.body.scrollTop),t},N=()=>{let t=0;return document.body.clientHeight&&document.documentElement.clientHeight?t=Math.min(document.body.clientHeight,document.documentElement.clientHeight):t=Math.max(document.body.clientHeight,document.documentElement.clientHeight),t},G=()=>Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);function L(t,e){let n=Date.now(),o=0;const i=()=>{let l=Date.now();l-n>=e&&(n=l=Date.now(),t()),cancelAnimationFrame(o),o=window.requestAnimationFrame(i)};return i(),o}exports.UA=r;exports._global=m;exports._support=A;exports.customizeSetInterval=L;exports.debounce=P;exports.getClientHeight=N;exports.getGlobal=p;exports.getGlobalSupport=g;exports.getLocationHref=I;exports.getScrollHeight=G;exports.getScrollTop=D;exports.getUrlParam=x;exports.htmlElementAsString=U;exports.inBrowser=f;exports.is360zhushou=E;exports.isAndroid=w;exports.isChrome=S;exports.isEdge=h;exports.isIE=y;exports.isIE9=b;exports.isIOS=T;exports.isMobile=_;exports.isWeiXin=H;exports.matchUrlFileName=O;exports.nativeTryCatch=v;exports.parseUrlToObj=C;exports.supportsHistory=B;exports.throttle=M;exports.throttle_02=$;
@@ -1,2 +1,5 @@
1
1
  import { SpanStatus } from "../types/index";
2
+ /**
3
+ * http请求的状态码进行转换
4
+ */
2
5
  export declare function fromHttpStatus(httpStatus: any): SpanStatus.Ok | SpanStatus.DeadlineExceeded | SpanStatus.Unauthenticated | SpanStatus.PermissionDenied | SpanStatus.NotFound | SpanStatus.ResourceExhausted | SpanStatus.InvalidArgument | SpanStatus.Unimplemented | SpanStatus.Unavailable | SpanStatus.InternalError | SpanStatus.UnknownError | SpanStatus.AlreadyExists | SpanStatus.FailedPrecondition;
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * img获取404时,设置默认的图片
3
+ * @param event
4
+ * @param defaultImage
3
5
  */
4
6
  export declare function imgError(event: any, defaultImage: string): void;
5
7
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * unknown转成自负出啊
2
+ * unknown转成字符串
3
3
  * @param target
4
4
  * @returns
5
5
  */
@@ -48,7 +48,7 @@ export declare function addBigBraceToStr(str: string): string;
48
48
  */
49
49
  export declare function validateEmail(str: string): boolean;
50
50
  /**
51
- * 验证固定电话
51
+ * 验证手机号
52
52
  * @param num
53
53
  * @returns
54
54
  */
@@ -9,11 +9,11 @@ export declare function getTimestamp(): number;
9
9
  * @param {number} timestamp - 时间戳
10
10
  * @return {string}
11
11
  */
12
- export declare const formatDate: (format?: string, timestamp?: number) => string;
12
+ export declare const formatDate: (timestamp?: number, format?: string) => string;
13
13
  /**
14
- * 时间格式化为两位数
14
+ * 数值格式化为两位数
15
15
  * @author beth
16
- * @DateTime 2020-05-22
16
+ * @DateTime 5 => 05
17
17
  * @return {Number} s
18
18
  */
19
19
  export declare const formatDate_02: (str: string) => string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function D(){return Date.now()}const x=(e="Y-M-D h:m:s",a=Date.now())=>{const n=new Date(a||Date.now()),t={Y:`${n.getFullYear()}`,M:`${n.getMonth()+1}`,D:`${n.getDate()}`,h:n.getHours(),m:n.getMinutes(),s:n.getSeconds()},o=r=>r>10?r:"0"+r;return(e||"Y-M-D h:m:s").replace("Y",t.Y).replace("M",t.M).replace("D",t.D).replace("h",o(t.h)).replace("m",o(t.m)).replace("s",o(t.s))},s=e=>Number(e)>=10?e:"0"+e;function c(){let e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const t=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(n=="x"?t:t&3|8).toString(16)})}function m(e){const a=new Date;let t=new Date(e).getTime()-a.getTime();return t<=0&&(t=0),Math.ceil(t/(60*60*24*1e3))}const u=(e,a)=>(a-e)/(1e3*3600*24);exports.formatDate=x;exports.formatDate_02=s;exports.generateUUID=c;exports.getDaysDiffBetweenDates=u;exports.getDaysDiffFromNow=m;exports.getTimestamp=D;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function D(){return Date.now()}const x=(e=Date.now(),a="Y-M-D h:m:s")=>{const n=new Date(e||Date.now()),t={Y:`${n.getFullYear()}`,M:`${n.getMonth()+1}`,D:`${n.getDate()}`,h:n.getHours(),m:n.getMinutes(),s:n.getSeconds()},o=r=>r>10?r:"0"+r;return(a||"Y-M-D h:m:s").replace("Y",t.Y).replace("M",t.M).replace("D",t.D).replace("h",o(t.h)).replace("m",o(t.m)).replace("s",o(t.s))},s=e=>Number(e)>=10?e:"0"+e;function c(){let e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const t=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(n=="x"?t:t&3|8).toString(16)})}function m(e){const a=new Date;let t=new Date(e).getTime()-a.getTime();return t<=0&&(t=0),Math.ceil(t/(60*60*24*1e3))}const u=(e,a)=>(a-e)/(1e3*3600*24);exports.formatDate=x;exports.formatDate_02=s;exports.generateUUID=c;exports.getDaysDiffBetweenDates=u;exports.getDaysDiffFromNow=m;exports.getTimestamp=D;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * 判断变量的类型
3
+ */
1
4
  export declare const variableTypeDetection: {
2
5
  isNumber: (value: any) => boolean;
3
6
  isString: (value: any) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vdrag-topo-utils",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "main": "dist/lib/index.js",
6
6
  "module": "dist/es/index.js",