jk-vue-comps 0.1.7 → 0.1.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.
@@ -0,0 +1,154 @@
1
+ import { nextTick as p, createVNode as h } from "vue";
2
+ import { isString as u, isHtmlStr as l, isObject as f, isNumber as c, is as w, isArray as S, isBoolean as N, isClient as b, isDate as x, isDef as $, isEdgeBrowser as O, isElement as T, isEmail as P, isEmpty as v, isFunction as y, isInMobileBrowser as E, isIp as I, isMap as L, isNull as B, isNullAndUnDef as U, isNullOrUnDef as q, isPromise as D, isPromiseLink as F, isRegExp as M, isServer as R, isUnDef as k, isUrl as _, isValidPhoneNumber as j, isWindow as z, isZhLang as H } from "../utils/is.js";
3
+ import { add as V, divide as W, formatRate as A, helper as G, isBigNum as Z, isBool as C, isEqualTo as J, isGreaterThan as K, isGreaterThanOrEqualTo as Q, isInt as X, isLessThan as Y, isLessThanOrEqualTo as ee, isNanValue as ie, isNum as te, multiply as re, power as ne, subtract as se, toBigNum as oe, toDecimalPlaces as ue, toInt as ae, toLocaleString as le, toNum as fe, toString as ce, unFormatRate as me } from "../utils/math.js";
4
+ import { propTypes as de } from "../utils/vuePropTypes.js";
5
+ import { timeZoneOptions as ge } from "../utils/timeZone.js";
6
+ import { withInstall as pe } from "../utils/withInstall.js";
7
+ function a(i) {
8
+ try {
9
+ return new Function(`'use strict'; return (${i});`)();
10
+ } catch {
11
+ return null;
12
+ }
13
+ }
14
+ function m(i, r = "float", t = 6) {
15
+ let e = String(i);
16
+ if (e = e.replace(/(^\s*)|(\s*$)/g, ""), e !== "") {
17
+ const s = e.indexOf("0") === 0 && e.length > 1 && e.indexOf(".") !== 1, n = r === "int" ? /[^\d]/g : /[^\d.]/g;
18
+ if (e = e.replace(n, ""), s)
19
+ return "0";
20
+ if (r === "int")
21
+ e = e.indexOf("0") === 0 && e.length > 1 ? e.substring(0, e.length - 1) : e;
22
+ else {
23
+ const o = a(`/\\.{${t},}/g`), g = a(`/^(\\d?)+(\\.\\d{0,${t}})?$/`);
24
+ e.indexOf(".") === 0 ? (e = "", e = e.replace(/[^$#$]/g, "0."), e = e.replace(o, ".")) : g.test(e) || (e = e.substring(0, e.length - 1));
25
+ }
26
+ }
27
+ return e;
28
+ }
29
+ function he(i, r, t, e = "int", s = 6) {
30
+ return (n) => {
31
+ p().then(() => {
32
+ var o;
33
+ i[r] = m((o = n == null ? void 0 : n.target) == null ? void 0 : o.value, e, s), t == null || t();
34
+ });
35
+ };
36
+ }
37
+ function we(i) {
38
+ return !u(i) || !l(i) ? i : h("div", { innerHTML: i });
39
+ }
40
+ function Se() {
41
+ return window ? `${window.location.protocol}//${window.location.hostname}` : "";
42
+ }
43
+ function Ne() {
44
+ const i = new URLSearchParams(window.location.search);
45
+ if (!i.size)
46
+ return;
47
+ const r = {};
48
+ for (const [t, e] of i.entries())
49
+ r[t] = e;
50
+ return r;
51
+ }
52
+ function be(i) {
53
+ return u(i) ? i.replace(/\s+/g, "") : "";
54
+ }
55
+ function d(i = {}, r = {}) {
56
+ let t;
57
+ for (t in r)
58
+ i[t] = f(i[t]) ? d(i[t], r[t]) : i[t] = r[t];
59
+ return i;
60
+ }
61
+ function xe(i, r = 6, t = {
62
+ showPrefix: !0,
63
+ showSuffix: !0,
64
+ middleStr: "****"
65
+ }) {
66
+ if (!u(i) && !c(i))
67
+ return i;
68
+ const e = String(i), s = (e == null ? void 0 : e.length) ?? 0;
69
+ if (!e || !s || r <= 0)
70
+ return e;
71
+ const n = t.showPrefix ? e.substring(0, r) : "", o = t.showSuffix ? e.substring(s - r) : "";
72
+ return `${n}${t.middleStr}${o}`;
73
+ }
74
+ const Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
75
+ __proto__: null,
76
+ add: V,
77
+ deepMerge: d,
78
+ desensitization: xe,
79
+ divide: W,
80
+ evalPro: a,
81
+ filterInputNum: m,
82
+ formatRate: A,
83
+ generateFilterInputNumFn: he,
84
+ getRouterParams: Ne,
85
+ getWebsiteUrl: Se,
86
+ helper: G,
87
+ is: w,
88
+ isArray: S,
89
+ isBigNum: Z,
90
+ isBool: C,
91
+ isBoolean: N,
92
+ isClient: b,
93
+ isDate: x,
94
+ isDef: $,
95
+ isEdgeBrowser: O,
96
+ isElement: T,
97
+ isEmail: P,
98
+ isEmpty: v,
99
+ isEqualTo: J,
100
+ isFunction: y,
101
+ isGreaterThan: K,
102
+ isGreaterThanOrEqualTo: Q,
103
+ isHtmlStr: l,
104
+ isInMobileBrowser: E,
105
+ isInt: X,
106
+ isIp: I,
107
+ isLessThan: Y,
108
+ isLessThanOrEqualTo: ee,
109
+ isMap: L,
110
+ isNanValue: ie,
111
+ isNull: B,
112
+ isNullAndUnDef: U,
113
+ isNullOrUnDef: q,
114
+ isNum: te,
115
+ isNumber: c,
116
+ isObject: f,
117
+ isPromise: D,
118
+ isPromiseLink: F,
119
+ isRegExp: M,
120
+ isServer: R,
121
+ isString: u,
122
+ isUnDef: k,
123
+ isUrl: _,
124
+ isValidPhoneNumber: j,
125
+ isWindow: z,
126
+ isZhLang: H,
127
+ multiply: re,
128
+ power: ne,
129
+ propTypes: de,
130
+ removeWhitespace: be,
131
+ renderHtmlStr: we,
132
+ subtract: se,
133
+ timeZoneOptions: ge,
134
+ toBigNum: oe,
135
+ toDecimalPlaces: ue,
136
+ toInt: ae,
137
+ toLocaleString: le,
138
+ toNum: fe,
139
+ toString: ce,
140
+ unFormatRate: me,
141
+ withInstall: pe
142
+ }, Symbol.toStringTag, { value: "Module" }));
143
+ export {
144
+ Se as a,
145
+ Ne as b,
146
+ be as c,
147
+ d,
148
+ a as e,
149
+ m as f,
150
+ he as g,
151
+ xe as h,
152
+ we as r,
153
+ Ee as u
154
+ };
@@ -1,6 +1,7 @@
1
1
  import { defineComponent as g, ref as p, onMounted as h, createVNode as C } from "vue";
2
2
  import { propTypes as f } from "../utils/vuePropTypes.js";
3
3
  import { isEdgeBrowser as w, isInMobileBrowser as _ } from "../utils/is.js";
4
+ import "../utils/math.js";
4
5
  import { withInstall as b } from "../utils/withInstall.js";
5
6
  function v(o, r) {
6
7
  if (!o || !r)
@@ -62,9 +63,9 @@ const I = /* @__PURE__ */ g({
62
63
  }))]);
63
64
  };
64
65
  }
65
- }), R = b(I);
66
+ }), j = b(I);
66
67
  export {
67
- R as GoogleAuth,
68
- R as default,
68
+ j as GoogleAuth,
69
+ j as default,
69
70
  v as toGoogleAuth
70
71
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as h, ref as g, onMounted as w, createVNode as b } from "vue";
2
2
  import { propTypes as m } from "../utils/vuePropTypes.js";
3
- import { a as _ } from "../chunks/index-C_baUQWz.js";
3
+ import { a as _ } from "../chunks/index-BPap5bmS.js";
4
4
  import { withInstall as A } from "../utils/withInstall.js";
5
5
  import { isEdgeBrowser as C, isInMobileBrowser as p } from "../utils/is.js";
6
6
  function d(r, o) {
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ declare const JKVUEComps: {
19
19
  showPrefix?: boolean | undefined;
20
20
  showSuffix?: boolean | undefined;
21
21
  middleStr?: string | undefined;
22
- }): string | number | undefined;
22
+ }): string | undefined;
23
23
  is(val: unknown, type: string): boolean;
24
24
  isDef<T_2 = unknown>(val?: T_2 | undefined): val is T_2;
25
25
  isUnDef<T_3 = unknown>(val?: T_3 | undefined): val is T_3;
@@ -50,6 +50,30 @@ declare const JKVUEComps: {
50
50
  isIp: (ip: string) => boolean;
51
51
  isEmail: (email: string) => boolean;
52
52
  isHtmlStr: (str: string) => boolean;
53
+ helper(val: utils.BigNumValType): import("bignumber.js").BigNumber;
54
+ isBool(val: any): val is boolean;
55
+ isBigNum(val: any): val is import("bignumber.js").BigNumber;
56
+ isNum(val: any): val is number;
57
+ isNanValue(val: any): boolean;
58
+ isInt(val: any): boolean;
59
+ isGreaterThan(num1: import("bignumber.js").BigNumber.Value, num2: import("bignumber.js").BigNumber.Value): boolean;
60
+ isLessThan(num1: import("bignumber.js").BigNumber.Value, num2: import("bignumber.js").BigNumber.Value): boolean;
61
+ isEqualTo(num1: import("bignumber.js").BigNumber.Value, num2: import("bignumber.js").BigNumber.Value): boolean;
62
+ isGreaterThanOrEqualTo(num1: import("bignumber.js").BigNumber.Value, num2: import("bignumber.js").BigNumber.Value): boolean;
63
+ isLessThanOrEqualTo(num1: import("bignumber.js").BigNumber.Value, num2: import("bignumber.js").BigNumber.Value): boolean;
64
+ toBigNum(val: utils.BigNumValType): import("bignumber.js").BigNumber;
65
+ toNum(val: utils.BigNumValType): number;
66
+ toInt(val: utils.BigNumValType, isUp?: boolean): number;
67
+ toString(val: utils.BigNumValType): string;
68
+ toDecimalPlaces(val: utils.BigNumValType, decimal?: number | undefined, isUp?: boolean): number;
69
+ toLocaleString(val: utils.BigNumValType): string;
70
+ add(...vals: utils.BigNumValType[]): number;
71
+ subtract(...vals: utils.BigNumValType[]): number;
72
+ multiply(...vals: utils.BigNumValType[]): number;
73
+ divide(...vals: utils.BigNumValType[]): number;
74
+ power(base: utils.BigNumValType, exponent: utils.BigNumValType): number;
75
+ formatRate(val: utils.BigNumValType, unit?: string): string;
76
+ unFormatRate(val: utils.BigNumValType): number;
53
77
  propTypes: typeof import("./utils/vuePropTypes").default;
54
78
  timeZoneOptions: utils.TimeZoneItem[];
55
79
  withInstall<T_7>(component: T_7, alias?: string | undefined): T_7 & import("vue").Plugin;
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { c as e } from "./chunks/index-BP9Q78TM.js";
2
- import { u as s } from "./chunks/index-C_baUQWz.js";
3
- import { d as m, h as l, e as n, f as p, g as u, b as f, a as g, c as h, r as d } from "./chunks/index-C_baUQWz.js";
4
- import { GoogleAuth as U, toGoogleAuth as c } from "./components/GoogleAuth.js";
5
- import { TelegramAuth as N, getTelegramAuthUrlParams as b, toTelegramAuth as E } from "./components/TelegramAuth.js";
6
- import { is as D, isArray as I, isBoolean as w, isClient as S, isDate as T, isDef as v, isEdgeBrowser as y, isElement as B, isEmail as C, isEmpty as F, isFunction as M, isHtmlStr as O, isInMobileBrowser as W, isIp as G, isMap as H, isNull as L, isNullAndUnDef as R, isNullOrUnDef as V, isNumber as Z, isObject as j, isPromise as k, isPromiseLink as z, isRegExp as J, isServer as K, isString as q, isUnDef as Q, isUrl as X, isValidPhoneNumber as Y, isWindow as _, isZhLang as $ } from "./utils/is.js";
7
- import { propTypes as se } from "./utils/vuePropTypes.js";
8
- import { timeZoneOptions as re } from "./utils/timeZone.js";
9
- import { withInstall as oe } from "./utils/withInstall.js";
2
+ import { u as s } from "./chunks/index-BPap5bmS.js";
3
+ import { d as l, h as m, e as n, f as u, g as p, b as g, a as f, c as h, r as d } from "./chunks/index-BPap5bmS.js";
4
+ import { GoogleAuth as c, toGoogleAuth as T } from "./components/GoogleAuth.js";
5
+ import { TelegramAuth as E, getTelegramAuthUrlParams as U, toTelegramAuth as b } from "./components/TelegramAuth.js";
6
+ import { is as I, isArray as P, isBoolean as B, isClient as D, isDate as S, isDef as w, isEdgeBrowser as L, isElement as O, isEmail as v, isEmpty as y, isFunction as F, isHtmlStr as G, isInMobileBrowser as R, isIp as q, isMap as C, isNull as M, isNullAndUnDef as V, isNullOrUnDef as W, isNumber as H, isObject as Z, isPromise as j, isPromiseLink as k, isRegExp as z, isServer as J, isString as K, isUnDef as Q, isUrl as X, isValidPhoneNumber as Y, isWindow as _, isZhLang as $ } from "./utils/is.js";
7
+ import { add as se, divide as ie, formatRate as re, helper as te, isBigNum as oe, isBool as ae, isEqualTo as le, isGreaterThan as me, isGreaterThanOrEqualTo as ne, isInt as ue, isLessThan as pe, isLessThanOrEqualTo as ge, isNanValue as fe, isNum as he, multiply as de, power as Ne, subtract as ce, toBigNum as Te, toDecimalPlaces as xe, toInt as Ee, toLocaleString as Ue, toNum as be, toString as Ae, unFormatRate as Ie } from "./utils/math.js";
8
+ import { propTypes as Be } from "./utils/vuePropTypes.js";
9
+ import { timeZoneOptions as Se } from "./utils/timeZone.js";
10
+ import { withInstall as Le } from "./utils/withInstall.js";
10
11
  const t = {
11
12
  ...e,
12
13
  ...s,
@@ -14,52 +15,76 @@ const t = {
14
15
  Comps: e
15
16
  };
16
17
  export {
17
- U as GoogleAuth,
18
- N as TelegramAuth,
19
- m as deepMerge,
18
+ c as GoogleAuth,
19
+ E as TelegramAuth,
20
+ se as add,
21
+ l as deepMerge,
20
22
  t as default,
21
- l as desensitization,
23
+ m as desensitization,
24
+ ie as divide,
22
25
  n as evalPro,
23
- p as filterInputNum,
24
- u as generateFilterInputNumFn,
25
- f as getRouterParams,
26
- b as getTelegramAuthUrlParams,
27
- g as getWebsiteUrl,
28
- D as is,
29
- I as isArray,
30
- w as isBoolean,
31
- S as isClient,
32
- T as isDate,
33
- v as isDef,
34
- y as isEdgeBrowser,
35
- B as isElement,
36
- C as isEmail,
37
- F as isEmpty,
38
- M as isFunction,
39
- O as isHtmlStr,
40
- W as isInMobileBrowser,
41
- G as isIp,
42
- H as isMap,
43
- L as isNull,
44
- R as isNullAndUnDef,
45
- V as isNullOrUnDef,
46
- Z as isNumber,
47
- j as isObject,
48
- k as isPromise,
49
- z as isPromiseLink,
50
- J as isRegExp,
51
- K as isServer,
52
- q as isString,
26
+ u as filterInputNum,
27
+ re as formatRate,
28
+ p as generateFilterInputNumFn,
29
+ g as getRouterParams,
30
+ U as getTelegramAuthUrlParams,
31
+ f as getWebsiteUrl,
32
+ te as helper,
33
+ I as is,
34
+ P as isArray,
35
+ oe as isBigNum,
36
+ ae as isBool,
37
+ B as isBoolean,
38
+ D as isClient,
39
+ S as isDate,
40
+ w as isDef,
41
+ L as isEdgeBrowser,
42
+ O as isElement,
43
+ v as isEmail,
44
+ y as isEmpty,
45
+ le as isEqualTo,
46
+ F as isFunction,
47
+ me as isGreaterThan,
48
+ ne as isGreaterThanOrEqualTo,
49
+ G as isHtmlStr,
50
+ R as isInMobileBrowser,
51
+ ue as isInt,
52
+ q as isIp,
53
+ pe as isLessThan,
54
+ ge as isLessThanOrEqualTo,
55
+ C as isMap,
56
+ fe as isNanValue,
57
+ M as isNull,
58
+ V as isNullAndUnDef,
59
+ W as isNullOrUnDef,
60
+ he as isNum,
61
+ H as isNumber,
62
+ Z as isObject,
63
+ j as isPromise,
64
+ k as isPromiseLink,
65
+ z as isRegExp,
66
+ J as isServer,
67
+ K as isString,
53
68
  Q as isUnDef,
54
69
  X as isUrl,
55
70
  Y as isValidPhoneNumber,
56
71
  _ as isWindow,
57
72
  $ as isZhLang,
58
- se as propTypes,
73
+ de as multiply,
74
+ Ne as power,
75
+ Be as propTypes,
59
76
  h as removeWhitespace,
60
77
  d as renderHtmlStr,
61
- re as timeZoneOptions,
62
- c as toGoogleAuth,
63
- E as toTelegramAuth,
64
- oe as withInstall
78
+ ce as subtract,
79
+ Se as timeZoneOptions,
80
+ Te as toBigNum,
81
+ xe as toDecimalPlaces,
82
+ T as toGoogleAuth,
83
+ Ee as toInt,
84
+ Ue as toLocaleString,
85
+ be as toNum,
86
+ Ae as toString,
87
+ b as toTelegramAuth,
88
+ Ie as unFormatRate,
89
+ Le as withInstall
65
90
  };
@@ -1,4 +1,5 @@
1
1
  export * from './is';
2
+ export * from './math';
2
3
  export * from './vuePropTypes';
3
4
  export * from './timeZone';
4
5
  export * from './withInstall';
@@ -43,4 +44,4 @@ export declare function desensitization(str?: string | number, number?: number,
43
44
  showPrefix?: boolean;
44
45
  showSuffix?: boolean;
45
46
  middleStr?: string;
46
- }): string | number | undefined;
47
+ }): string | undefined;
@@ -1,50 +1,75 @@
1
1
  import "vue";
2
- import { is as r, isArray as t, isBoolean as o, isClient as n, isDate as a, isDef as l, isEdgeBrowser as m, isElement as p, isEmail as f, isEmpty as u, isFunction as g, isHtmlStr as d, isInMobileBrowser as N, isIp as b, isMap as x, isNull as h, isNullAndUnDef as D, isNullOrUnDef as E, isNumber as I, isObject as P, isPromise as U, isPromiseLink as c, isRegExp as w, isServer as S, isString as v, isUnDef as y, isUrl as B, isValidPhoneNumber as F, isWindow as M, isZhLang as O } from "./is.js";
3
- import { propTypes as A } from "./vuePropTypes.js";
4
- import { timeZoneOptions as L } from "./timeZone.js";
5
- import { withInstall as Z } from "./withInstall.js";
6
- import { d as k, h as z, e as C, f as T, g as V, b as q, a as G, c as J, r as K } from "../chunks/index-C_baUQWz.js";
2
+ import { is as r, isArray as t, isBoolean as o, isClient as a, isDate as n, isDef as l, isEdgeBrowser as m, isElement as p, isEmail as u, isEmpty as f, isFunction as g, isHtmlStr as d, isInMobileBrowser as N, isIp as h, isMap as c, isNull as E, isNullAndUnDef as T, isNullOrUnDef as b, isNumber as x, isObject as I, isPromise as B, isPromiseLink as D, isRegExp as P, isServer as S, isString as w, isUnDef as L, isUrl as O, isValidPhoneNumber as U, isWindow as v, isZhLang as y } from "./is.js";
3
+ import { add as R, divide as q, formatRate as M, helper as W, isBigNum as A, isBool as G, isEqualTo as H, isGreaterThan as V, isGreaterThanOrEqualTo as Z, isInt as j, isLessThan as k, isLessThanOrEqualTo as z, isNanValue as C, isNum as J, multiply as K, power as Q, subtract as X, toBigNum as Y, toDecimalPlaces as _, toInt as $, toLocaleString as ee, toNum as ie, toString as se, unFormatRate as re } from "./math.js";
4
+ import { propTypes as oe } from "./vuePropTypes.js";
5
+ import { timeZoneOptions as ne } from "./timeZone.js";
6
+ import { withInstall as me } from "./withInstall.js";
7
+ import { d as ue, h as fe, e as ge, f as de, g as Ne, b as he, a as ce, c as Ee, r as Te } from "../chunks/index-BPap5bmS.js";
7
8
  export {
8
- k as deepMerge,
9
- z as desensitization,
10
- C as evalPro,
11
- T as filterInputNum,
12
- V as generateFilterInputNumFn,
13
- q as getRouterParams,
14
- G as getWebsiteUrl,
9
+ R as add,
10
+ ue as deepMerge,
11
+ fe as desensitization,
12
+ q as divide,
13
+ ge as evalPro,
14
+ de as filterInputNum,
15
+ M as formatRate,
16
+ Ne as generateFilterInputNumFn,
17
+ he as getRouterParams,
18
+ ce as getWebsiteUrl,
19
+ W as helper,
15
20
  r as is,
16
21
  t as isArray,
22
+ A as isBigNum,
23
+ G as isBool,
17
24
  o as isBoolean,
18
- n as isClient,
19
- a as isDate,
25
+ a as isClient,
26
+ n as isDate,
20
27
  l as isDef,
21
28
  m as isEdgeBrowser,
22
29
  p as isElement,
23
- f as isEmail,
24
- u as isEmpty,
30
+ u as isEmail,
31
+ f as isEmpty,
32
+ H as isEqualTo,
25
33
  g as isFunction,
34
+ V as isGreaterThan,
35
+ Z as isGreaterThanOrEqualTo,
26
36
  d as isHtmlStr,
27
37
  N as isInMobileBrowser,
28
- b as isIp,
29
- x as isMap,
30
- h as isNull,
31
- D as isNullAndUnDef,
32
- E as isNullOrUnDef,
33
- I as isNumber,
34
- P as isObject,
35
- U as isPromise,
36
- c as isPromiseLink,
37
- w as isRegExp,
38
+ j as isInt,
39
+ h as isIp,
40
+ k as isLessThan,
41
+ z as isLessThanOrEqualTo,
42
+ c as isMap,
43
+ C as isNanValue,
44
+ E as isNull,
45
+ T as isNullAndUnDef,
46
+ b as isNullOrUnDef,
47
+ J as isNum,
48
+ x as isNumber,
49
+ I as isObject,
50
+ B as isPromise,
51
+ D as isPromiseLink,
52
+ P as isRegExp,
38
53
  S as isServer,
39
- v as isString,
40
- y as isUnDef,
41
- B as isUrl,
42
- F as isValidPhoneNumber,
43
- M as isWindow,
44
- O as isZhLang,
45
- A as propTypes,
46
- J as removeWhitespace,
47
- K as renderHtmlStr,
48
- L as timeZoneOptions,
49
- Z as withInstall
54
+ w as isString,
55
+ L as isUnDef,
56
+ O as isUrl,
57
+ U as isValidPhoneNumber,
58
+ v as isWindow,
59
+ y as isZhLang,
60
+ K as multiply,
61
+ Q as power,
62
+ oe as propTypes,
63
+ Ee as removeWhitespace,
64
+ Te as renderHtmlStr,
65
+ X as subtract,
66
+ ne as timeZoneOptions,
67
+ Y as toBigNum,
68
+ _ as toDecimalPlaces,
69
+ $ as toInt,
70
+ ee as toLocaleString,
71
+ ie as toNum,
72
+ se as toString,
73
+ re as unFormatRate,
74
+ me as withInstall
50
75
  };
@@ -0,0 +1,104 @@
1
+ import BJS from 'bignumber.js';
2
+ export type BigNumVal = Parameters<typeof BJS>[0];
3
+ export type BigNumValType = BigNumVal | undefined | null | boolean;
4
+ export type BigNumObj = BJS;
5
+ export declare function helper(val: BigNumValType): BigNumObj;
6
+ /** 是否为boolean值 */
7
+ export declare function isBool(val: any): val is boolean;
8
+ /** 是否为BigNumber对象 */
9
+ export declare function isBigNum(val: any): val is BigNumObj;
10
+ /** 是否为数字 */
11
+ export declare function isNum(val: any): val is number;
12
+ /** 是否为NaN值(传入任意值转bignumber是否为NaN) */
13
+ export declare function isNanValue(val: any): boolean;
14
+ /** 是否为整数(传入任意值转bignumber是否为整数) */
15
+ export declare function isInt(val: any): boolean;
16
+ /** 是否大于
17
+ * @example isGreaterThan('456', 132) => true
18
+ */
19
+ export declare function isGreaterThan(num1: BigNumVal, num2: BigNumVal): boolean;
20
+ /** 是否小于
21
+ * @example isLessThan('123', 132) => true
22
+ */
23
+ export declare function isLessThan(num1: BigNumVal, num2: BigNumVal): boolean;
24
+ /** 是否等于
25
+ * @example isEqualTo('123', 123) => true
26
+ */
27
+ export declare function isEqualTo(num1: BigNumVal, num2: BigNumVal): boolean;
28
+ /** 是否大于等于
29
+ * @example isGreaterThanOrEqualTo('1223', 123) => true
30
+ * @example isGreaterThanOrEqualTo('123', 123) => true
31
+ */
32
+ export declare function isGreaterThanOrEqualTo(num1: BigNumVal, num2: BigNumVal): boolean;
33
+ /** 是否小于等于
34
+ * @example isLessThanOrEqualTo('123', 123) => true
35
+ * @example isLessThanOrEqualTo('13', 123) => true
36
+ */
37
+ export declare function isLessThanOrEqualTo(num1: BigNumVal, num2: BigNumVal): boolean;
38
+ /** 转为BigNumber对象 */
39
+ export declare function toBigNum(val: BigNumValType): BJS;
40
+ /** 转为数字 */
41
+ export declare function toNum(val: BigNumValType): number;
42
+ /**
43
+ * 转为整数
44
+ * @example toInt(15.99) => 15
45
+ * @example toInt(-22.22) => -22
46
+ */
47
+ export declare function toInt(val: BigNumValType, isUp?: boolean): number;
48
+ /** 转为字符串 */
49
+ export declare function toString(val: BigNumValType): string;
50
+ /**
51
+ * 保留小数位(超过指定位数截断,小于位数不进行0补充)
52
+ * @param val val
53
+ * @param decimal 保留小数位数
54
+ * @param isUp 是否向上舍入 default: false
55
+ * @example toDecimalPlaces(2.326, 2) => 2.32
56
+ * @example toDecimalPlaces(-5.526, 2) => -5.52
57
+ * @example toDecimalPlaces(2.326, 2, true) => 2.33
58
+ * @example toDecimalPlaces(-5.526, 2, true) => -5.53
59
+ */
60
+ export declare function toDecimalPlaces(val: BigNumValType, decimal?: number, isUp?: boolean): number;
61
+ /** 转为千位符数字 */
62
+ export declare function toLocaleString(val: BigNumValType): string;
63
+ /**
64
+ * 相加
65
+ * @example add(3, 3) => 6
66
+ * @example add(3, 3, 4) => 10
67
+ */
68
+ export declare function add(...vals: BigNumValType[]): number;
69
+ /**
70
+ * 相减
71
+ * @example subtract('5', 3) => 2
72
+ * @example subtract(5, 3, '2') => 0
73
+ */
74
+ export declare function subtract(...vals: BigNumValType[]): number;
75
+ /**
76
+ * 相乘
77
+ * @example multiply('3', 5) => 15
78
+ * @example multiply(3, 5, '2') => 30
79
+ */
80
+ export declare function multiply(...vals: BigNumValType[]): number;
81
+ /**
82
+ * 相除
83
+ * @example divide('9', 3) => 3
84
+ * @example divide('100', 2, 10) => 5
85
+ * @example divide('100', 0, 10) => 0
86
+ */
87
+ export declare function divide(...vals: BigNumValType[]): number;
88
+ /**
89
+ * 幂运算
90
+ * @example power('2', '3') => 8
91
+ * @example power('10', 2) => 100
92
+ * @example power('-2', 3) => -8
93
+ */
94
+ export declare function power(base: BigNumValType, exponent: BigNumValType): number;
95
+ /**
96
+ * 小数转为百分比
97
+ * @example 0.1111 => 11.11%
98
+ */
99
+ export declare function formatRate(val: BigNumValType, unit?: string): string;
100
+ /**
101
+ * 转为百分小数
102
+ * @example 22.22 => 0.2222
103
+ */
104
+ export declare function unFormatRate(val: BigNumValType): number;