@spacego/turbo-utils 0.0.1-alpha → 0.0.1-alpha.2
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/README.md +30 -30
- package/lib/cjs/_virtual/dayjs.min.cjs +1 -0
- package/lib/cjs/calc/calc.cjs +1 -0
- package/lib/cjs/calc/index.cjs +1 -0
- package/lib/cjs/day/dayjs.cjs +1 -0
- package/lib/cjs/index.cjs +1 -0
- package/lib/cjs/is/is-empty.cjs +1 -0
- package/lib/cjs/is/is-equals.cjs +1 -0
- package/lib/cjs/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.cjs +1 -0
- package/lib/cjs/utils/classnames.cjs +1 -0
- package/lib/cjs/utils/query2params.cjs +1 -0
- package/lib/cjs/utils/util.cjs +1 -0
- package/lib/cjs/validator/validate.cjs +1 -0
- package/lib/es/index.js +59 -57
- package/lib/es/is/is-empty.js +1 -1
- package/lib/es/is/is-equals.js +18 -9
- package/lib/es/utils/classnames.js +17 -0
- package/lib/es/utils/query2params.js +33 -33
- package/lib/es/utils/util.js +15 -16
- package/lib/types/is/index.d.ts +2 -2
- package/lib/types/is/is-empty.d.ts +1 -2
- package/lib/types/is/is-equals.d.ts +10 -2
- package/lib/types/utils/classnames.d.ts +1 -2
- package/lib/types/utils/util.d.ts +2 -6
- package/package.json +1 -1
- package/lib/cjs/_virtual/dayjs.min.js +0 -1
- package/lib/cjs/calc/calc.js +0 -1
- package/lib/cjs/calc/index.js +0 -1
- package/lib/cjs/day/dayjs.js +0 -1
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/is/is-empty.js +0 -1
- package/lib/cjs/is/is-equals.js +0 -1
- package/lib/cjs/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js +0 -1
- package/lib/cjs/utils/query2params.js +0 -1
- package/lib/cjs/utils/util.js +0 -1
- package/lib/cjs/validator/validate.js +0 -1
- /package/lib/cjs/_virtual/{_commonjsHelpers.js → _commonjsHelpers.cjs} +0 -0
- /package/lib/cjs/_virtual/{dayjs.min2.js → dayjs.min2.cjs} +0 -0
- /package/lib/cjs/is/{is.js → is.cjs} +0 -0
- /package/lib/cjs/node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/{decimal.js → decimal.cjs} +0 -0
- /package/lib/cjs/utils/{deep-clone.js → deep-clone.cjs} +0 -0
- /package/lib/cjs/utils/{pick.js → pick.cjs} +0 -0
- /package/lib/cjs/utils/{uuid.js → uuid.cjs} +0 -0
- /package/lib/cjs/validator/{validator.js → validator.cjs} +0 -0
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# @spacego/turbo-utils
|
|
2
|
-
|
|
3
|
-
`@spacego/turbo-utils` 是一个完全基于 `typescript` 的工具库,提供了一些常用的工具函数等。
|
|
4
|
-
|
|
5
|
-
## ✨ Features
|
|
6
|
-
|
|
7
|
-
- Easy to learn and use.
|
|
8
|
-
- Contains common hooks and encapsulates common apis.
|
|
9
|
-
- Written in TypeScript with predictable static types.
|
|
10
|
-
- High performance.
|
|
11
|
-
|
|
12
|
-
## 📦 Install
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
$ npm install --save @spacego/turbo-utils
|
|
16
|
-
# or
|
|
17
|
-
$ pnpm add @spacego/turbo-utils `推荐`
|
|
18
|
-
# or
|
|
19
|
-
$ yarn add @spacego/turbo-utils
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## 🔨 Usage
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
import { padQuery, pick, deepClone, uuid ... } from '@spacego/turbo-utils';
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## 🚀 API
|
|
29
|
-
|
|
30
|
-
...
|
|
1
|
+
# @spacego/turbo-utils
|
|
2
|
+
|
|
3
|
+
`@spacego/turbo-utils` 是一个完全基于 `typescript` 的工具库,提供了一些常用的工具函数等。
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- Easy to learn and use.
|
|
8
|
+
- Contains common hooks and encapsulates common apis.
|
|
9
|
+
- Written in TypeScript with predictable static types.
|
|
10
|
+
- High performance.
|
|
11
|
+
|
|
12
|
+
## 📦 Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
$ npm install --save @spacego/turbo-utils
|
|
16
|
+
# or
|
|
17
|
+
$ pnpm add @spacego/turbo-utils `推荐`
|
|
18
|
+
# or
|
|
19
|
+
$ yarn add @spacego/turbo-utils
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🔨 Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { padQuery, pick, deepClone, uuid ... } from '@spacego/turbo-utils';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 🚀 API
|
|
29
|
+
|
|
30
|
+
...
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./_commonjsHelpers.cjs"),r=require("../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.cjs");var t=r.__require();const s=e.getDefaultExportFromCjs(t);exports.default=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.cjs"),l={add:function(t,e){return new i.Decimal(t).add(new i.Decimal(e)).toNumber()},subtract:function(t,e){return new i.Decimal(t).sub(new i.Decimal(e)).toNumber()},multiply:function(t,e){return new i.Decimal(t).mul(new i.Decimal(e)).toNumber()},divide:function(t,e){return new i.Decimal(t).div(new i.Decimal(e)).toNumber()},saveCeilFloat:(t,e=2)=>l.divide(Math.ceil(l.multiply(t,Math.pow(10,e))),Math.pow(10,e)).toFixedNew(e)};exports.default=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./calc.cjs"),i=require("../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.cjs");Number.prototype.toFixedNew=function(t){let e=this;return e<0?(e=e*-1,(Math.round(o.default.multiply(e,Math.pow(10,t)))/Math.pow(10,t)*-1).toFixed(t)):(Math.round(o.default.multiply(e,Math.pow(10,t)))/Math.pow(10,t)).toFixed(t)};Number.prototype.countDecimals=function(){return Math.floor(this.valueOf())===this.valueOf()?0:this.toString().split(".")[1].length||0};exports.calc=o.default;exports.Decimal=i.Decimal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../_virtual/dayjs.min.cjs");require("../calc/index.cjs");const c=require("../utils/util.cjs");function m(r){return r.replace(/\-/g,"/")}function d(r,e){const t=l.default(r);e===void 0&&(e="yyyy-MM-dd HH:mm:ss");const a={"M+":t.month()+1,"d+":t.date(),"h+":t.hour()%12===0?12:t.hour()%12,"H+":t.hour(),"m+":t.minute(),"s+":t.second(),"q+":Math.floor((t.month()+3)/3),S:t.millisecond()},o={0:"日",1:"一",2:"二",3:"三",4:"四",5:"五",6:"六"};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.year()+"").substr(4-RegExp.$1.length))),/(E+)/.test(e)&&(e=e.replace(RegExp.$1,(RegExp.$1.length>1?RegExp.$1.length>2?"星期":"周":"")+o[t.day()+""]));for(const n in a)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,RegExp.$1.length===1?a[n]:("00"+a[n]).substr((""+a[n]).length)));return e}const i=["日","一","二","三","四","五","六"];function f(r){const e=l.default(r),t={y:e.year()+"",m:e.month()+1+"",d:e.date()+"",h:e.hour()+"",mm:e.minute()+"",ss:e.second()+"",w:i[e.day()]};for(const a in t)Object.hasOwnProperty.call(t,a)&&!["y","w"].includes(a)&&(t[a]=c.padZero(t[a]));return t}function g(r){const e=l.default(r).valueOf(),t=l.default().valueOf(),a=t-e;if(a<0)return"未来的时间";const o=[{label:"年",value:365*24*60*60*1e3},{label:"月",value:720*60*60*1e3},{label:"周",value:10080*60*1e3},{label:"天",value:1440*60*1e3},{label:"小时",value:3600*1e3},{label:"分钟",value:60*1e3},{label:"刚刚",value:10*1e3}];if(a<o[o.length-1].value)return"刚刚";for(const{label:n,value:u}of o.slice(0,-1)){const s=a/u;if(s>=1)return n==="天"&&s<2?s===1?"昨天":"今天":`${Math.floor(s)} ${n}前`}return"刚刚"}function D(r,e){if(!r)return"";const t=l.default(r),{m:a,d:o,w:n}=f(r);if(e){const u=l.default(e);return t.format("YYYY-MM-DD")===u.format("YYYY-MM-DD")?`${a}月${o}日 周${n} ${t.format("HH:mm")}-${u.format("HH:mm")}`:`${t.format("MM月DD日 HH:mm")} - ${u.format("MM月DD日 HH:mm")}`}else return`${a}月${o}日 周${n} ${t.format("HH:mm")}`}exports.WEEK_DAY=i;exports.formatActivityTime=D;exports.formatDate=d;exports.formatIosDate=m;exports.getDateDiff=g;exports.getDateParams=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./calc/index.cjs");const a=require("./day/dayjs.cjs"),l=require("./_virtual/dayjs.min.cjs"),e=require("./is/is.cjs"),u=require("./is/is-empty.cjs"),t=require("./is/is-equals.cjs"),c=require("./utils/classnames.cjs"),d=require("./utils/deep-clone.cjs"),m=require("./utils/pick.cjs"),s=require("./utils/query2params.cjs"),r=require("./utils/util.cjs"),n=require("./utils/uuid.cjs"),o=require("./validator/validate.cjs"),i=require("./validator/validator.cjs"),p=require("./calc/calc.cjs"),y=require("./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.cjs");exports.WEEK_DAY=a.WEEK_DAY;exports.formatActivityTime=a.formatActivityTime;exports.formatDate=a.formatDate;exports.formatIosDate=a.formatIosDate;exports.getDateDiff=a.getDateDiff;exports.getDateParams=a.getDateParams;exports.dayjs=l.default;exports.isArray=e.isArray;exports.isBoolean=e.isBoolean;exports.isDate=e.isDate;exports.isFile=e.isFile;exports.isFunction=e.isFunction;exports.isMap=e.isMap;exports.isNull=e.isNull;exports.isNumber=e.isNumber;exports.isObject=e.isObject;exports.isPromise=e.isPromise;exports.isRegExp=e.isRegExp;exports.isSet=e.isSet;exports.isString=e.isString;exports.isUndefined=e.isUndefined;exports.isEmpty=u.isEmpty;exports.depsAreSame=t.depsAreSame;exports.isEquals=t.isEquals;exports.classnames=c.classnames;exports.deepClone=d.deepClone;exports.pick=m.pick;exports.filterParams=s.filterParams;exports.filterQuery=s.filterQuery;exports.filtrationEmpty=s.filtrationEmpty;exports.getUrlParam=s.getUrlParam;exports.json2params=s.json2params;exports.padQuery=s.padQuery;exports.params2json=s.params2json;exports.ObjectAssign=r.ObjectAssign;exports.browser=r.browser;exports.calculateDistance=r.calculateDistance;exports.encryptString=r.encryptString;exports.isBrowser=r.isBrowser;exports.padZero=r.padZero;exports.thousands=r.thousands;exports.randomString=n.randomString;exports.uuid=n.uuid;exports.validate=o.validate;exports.validateRequire=o.validateRequire;exports.isCard=i.isCard;exports.isCurrency=i.isCurrency;exports.isEmail=i.isEmail;exports.isIdCard=i.isIdCard;exports.isMobile=i.isMobile;exports.isPassport=i.isPassport;exports.isUrl=i.isUrl;exports.maxLength=i.maxLength;exports.minLength=i.minLength;exports.regs=i.regs;exports.required=i.required;exports.validateType=i.validateType;exports.validation=i.validation;exports.calc=p.default;exports.Decimal=y.Decimal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&Object.keys(t).length===0||typeof t=="number"&&t===0||typeof t>"u"||t instanceof Map&&t.size===0||t instanceof Set&&t.size===0)}exports.isEmpty=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(r,t){if(r===t)return!0;if(r===null||t===null)return!1;if(Array.isArray(r)&&Array.isArray(t)){if(r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!f(r[n],t[n]))return!1;return!0}if(typeof r!="object"||typeof t!="object")return!1;const e=Object.getOwnPropertyNames(r),s=Object.getOwnPropertyNames(t);if(e.length!==s.length)return!1;for(let n=0;n<e.length;n++){const i=e[n];if(!f(r[i],t[i]))return!1}return!0}function o(r,t){if(r===t)return!0;for(let e=0;e<r.length;e++)if(!Object.is(r[e],t[e]))return!1;return!0}exports.depsAreSame=o;exports.isEquals=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../../../../../_virtual/dayjs.min2.cjs");var G=C.__module.exports,V;function K(){return V||(V=1,(function(P,X){(function(A,k){P.exports=k()})(G,(function(){var A=1e3,k=6e4,U=36e5,I="millisecond",p="second",_="minute",w="hour",M="day",H="week",m="month",F="quarter",y="year",O="date",J="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,E=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Q={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(i){var n=["th","st","nd","rd"],t=i%100;return"["+i+(n[(t-20)%10]||n[t]||n[0])+"]"}},q=function(i,n,t){var r=String(i);return!r||r.length>=n?i:""+Array(n+1-r.length).join(t)+i},R={s:q,z:function(i){var n=-i.utcOffset(),t=Math.abs(n),r=Math.floor(t/60),e=t%60;return(n<=0?"+":"-")+q(r,2,"0")+":"+q(e,2,"0")},m:function i(n,t){if(n.date()<t.date())return-i(t,n);var r=12*(t.year()-n.year())+(t.month()-n.month()),e=n.clone().add(r,m),s=t-e<0,u=n.clone().add(r+(s?-1:1),m);return+(-(r+(t-e)/(s?e-u:u-e))||0)},a:function(i){return i<0?Math.ceil(i)||0:Math.floor(i)},p:function(i){return{M:m,y,w:H,d:M,D:O,h:w,m:_,s:p,ms:I,Q:F}[i]||String(i||"").toLowerCase().replace(/s$/,"")},u:function(i){return i===void 0}},x="en",D={};D[x]=Q;var Z="$isDayjsObject",N=function(i){return i instanceof L||!(!i||!i[Z])},j=function i(n,t,r){var e;if(!n)return x;if(typeof n=="string"){var s=n.toLowerCase();D[s]&&(e=s),t&&(D[s]=t,e=s);var u=n.split("-");if(!e&&u.length>1)return i(u[0])}else{var o=n.name;D[o]=n,e=o}return!r&&e&&(x=e),e||!r&&x},f=function(i,n){if(N(i))return i.clone();var t=typeof n=="object"?n:{};return t.date=i,t.args=arguments,new L(t)},a=R;a.l=j,a.i=N,a.w=function(i,n){return f(i,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var L=(function(){function i(t){this.$L=j(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[Z]=!0}var n=i.prototype;return n.parse=function(t){this.$d=(function(r){var e=r.date,s=r.utc;if(e===null)return new Date(NaN);if(a.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var u=e.match(B);if(u){var o=u[2]-1||0,c=(u[7]||"0").substring(0,3);return s?new Date(Date.UTC(u[1],o,u[3]||1,u[4]||0,u[5]||0,u[6]||0,c)):new Date(u[1],o,u[3]||1,u[4]||0,u[5]||0,u[6]||0,c)}}return new Date(e)})(t),this.init()},n.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},n.$utils=function(){return a},n.isValid=function(){return this.$d.toString()!==J},n.isSame=function(t,r){var e=f(t);return this.startOf(r)<=e&&e<=this.endOf(r)},n.isAfter=function(t,r){return f(t)<this.startOf(r)},n.isBefore=function(t,r){return this.endOf(r)<f(t)},n.$g=function(t,r,e){return a.u(t)?this[r]:this.set(e,t)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(t,r){var e=this,s=!!a.u(r)||r,u=a.p(t),o=function(S,$){var v=a.w(e.$u?Date.UTC(e.$y,$,S):new Date(e.$y,$,S),e);return s?v:v.endOf(M)},c=function(S,$){return a.w(e.toDate()[S].apply(e.toDate("s"),(s?[0,0,0,0]:[23,59,59,999]).slice($)),e)},h=this.$W,d=this.$M,l=this.$D,b="set"+(this.$u?"UTC":"");switch(u){case y:return s?o(1,0):o(31,11);case m:return s?o(1,d):o(0,d+1);case H:var g=this.$locale().weekStart||0,T=(h<g?h+7:h)-g;return o(s?l-T:l+(6-T),d);case M:case O:return c(b+"Hours",0);case w:return c(b+"Minutes",1);case _:return c(b+"Seconds",2);case p:return c(b+"Milliseconds",3);default:return this.clone()}},n.endOf=function(t){return this.startOf(t,!1)},n.$set=function(t,r){var e,s=a.p(t),u="set"+(this.$u?"UTC":""),o=(e={},e[M]=u+"Date",e[O]=u+"Date",e[m]=u+"Month",e[y]=u+"FullYear",e[w]=u+"Hours",e[_]=u+"Minutes",e[p]=u+"Seconds",e[I]=u+"Milliseconds",e)[s],c=s===M?this.$D+(r-this.$W):r;if(s===m||s===y){var h=this.clone().set(O,1);h.$d[o](c),h.init(),this.$d=h.set(O,Math.min(this.$D,h.daysInMonth())).$d}else o&&this.$d[o](c);return this.init(),this},n.set=function(t,r){return this.clone().$set(t,r)},n.get=function(t){return this[a.p(t)]()},n.add=function(t,r){var e,s=this;t=Number(t);var u=a.p(r),o=function(d){var l=f(s);return a.w(l.date(l.date()+Math.round(d*t)),s)};if(u===m)return this.set(m,this.$M+t);if(u===y)return this.set(y,this.$y+t);if(u===M)return o(1);if(u===H)return o(7);var c=(e={},e[_]=k,e[w]=U,e[p]=A,e)[u]||1,h=this.$d.getTime()+t*c;return a.w(h,this)},n.subtract=function(t,r){return this.add(-1*t,r)},n.format=function(t){var r=this,e=this.$locale();if(!this.isValid())return e.invalidDate||J;var s=t||"YYYY-MM-DDTHH:mm:ssZ",u=a.z(this),o=this.$H,c=this.$m,h=this.$M,d=e.weekdays,l=e.months,b=e.meridiem,g=function($,v,Y,W){return $&&($[v]||$(r,s))||Y[v].slice(0,W)},T=function($){return a.s(o%12||12,$,"0")},S=b||function($,v,Y){var W=$<12?"AM":"PM";return Y?W.toLowerCase():W};return s.replace(E,(function($,v){return v||(function(Y){switch(Y){case"YY":return String(r.$y).slice(-2);case"YYYY":return a.s(r.$y,4,"0");case"M":return h+1;case"MM":return a.s(h+1,2,"0");case"MMM":return g(e.monthsShort,h,l,3);case"MMMM":return g(l,h);case"D":return r.$D;case"DD":return a.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return g(e.weekdaysMin,r.$W,d,2);case"ddd":return g(e.weekdaysShort,r.$W,d,3);case"dddd":return d[r.$W];case"H":return String(o);case"HH":return a.s(o,2,"0");case"h":return T(1);case"hh":return T(2);case"a":return S(o,c,!0);case"A":return S(o,c,!1);case"m":return String(c);case"mm":return a.s(c,2,"0");case"s":return String(r.$s);case"ss":return a.s(r.$s,2,"0");case"SSS":return a.s(r.$ms,3,"0");case"Z":return u}return null})($)||u.replace(":","")}))},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var s,u=this,o=a.p(r),c=f(t),h=(c.utcOffset()-this.utcOffset())*k,d=this-c,l=function(){return a.m(u,c)};switch(o){case y:s=l()/12;break;case m:s=l();break;case F:s=l()/3;break;case H:s=(d-h)/6048e5;break;case M:s=(d-h)/864e5;break;case w:s=d/U;break;case _:s=d/k;break;case p:s=d/A;break;default:s=d}return e?s:a.a(s)},n.daysInMonth=function(){return this.endOf(m).$D},n.$locale=function(){return D[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),s=j(t,r,!0);return s&&(e.$L=s),e},n.clone=function(){return a.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},i})(),z=L.prototype;return f.prototype=z,[["$ms",I],["$s",p],["$m",_],["$H",w],["$W",M],["$M",m],["$y",y],["$D",O]].forEach((function(i){z[i[1]]=function(n){return this.$g(n,i[0],i[1])}})),f.extend=function(i,n){return i.$i||(i(n,L,f),i.$i=!0),f},f.locale=j,f.isDayjs=N,f.unix=function(i){return f(1e3*i)},f.en=D[x],f.Ls=D,f.p={},f}))})(C.__module)),C.__module.exports}exports.__require=K;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../calc/index.cjs");require("../_virtual/dayjs.min.cjs");const i=require("../is/is.cjs");function c(...t){return t.filter(s=>!!s).map(s=>{if(i.isObject(s)){const e=[];Object.keys(s).forEach(r=>{s[r]&&e.push(r)}),s=e.join(" ")}return s}).join(" ")}exports.classnames=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./util.cjs");require("../calc/index.cjs");require("../_virtual/dayjs.min.cjs");const E=require("../is/is.cjs"),u=require("../is/is-empty.cjs");function o(e,r="&"){return u.isEmpty(e)?{}:decodeURIComponent(e).replace(/^\?/,"").split(r).reduce((t,m)=>{const[s,y]=m.split("=");if(s){const a=y??"";t[s]&&typeof t[s]=="string"?t[s]=[t[s],a]:t[s]?t[s].push(a):t[s]=a}return t},{})}function p(e,r="&"){return u.isEmpty(e)?"":Object.keys(e).map(n=>{const i=e[n];return Array.isArray(i)?i.map(t=>`${n}=${t}`).join(r):`${n}=${i}`}).join(r)}function g(e,r){const n=d.isBrowser?window:{location:{search:""}},i=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),t=(r||n.location.search).substr(1).match(i);return t!=null?unescape(t[2]):null}function f(e){return Object.keys(e).forEach(r=>{(u.isEmpty(e[r])||e[r]==="undefined")&&e[r]!==0&&delete e[r]}),e}function c(e,r=[]){const n=E.isString(e);if(u.isEmpty(e))return n?"":{};const i=n?o(e):e;return r.forEach(t=>{delete i[t]}),n?p(i):i}function l(e,r){if(u.isEmpty(e))return"";e=decodeURIComponent(e);const[n,i]=e.split("?"),t=f(Object.assign({},o(i),f(Object.assign({},r||{}))));return`${n}?${p(t)}`}function h(e,r=[]){if(u.isEmpty(e))return"";const[n,i=""]=e.split("?");return l(n,o(c(i,r)))}exports.filterParams=c;exports.filterQuery=h;exports.filtrationEmpty=f;exports.getUrlParam=g;exports.json2params=p;exports.padQuery=l;exports.params2json=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../calc/index.cjs");require("../_virtual/dayjs.min.cjs");const l=require("../is/is.cjs"),c=require("../is/is-empty.cjs"),p=!!(typeof window<"u"&&window.document&&window.document.createElement);function M(t,n,i){return c.isEmpty(t)||c.isEmpty(n)||Object.keys(t).forEach(e=>{n[e]!==void 0&&!(i!=null&&i.includes(e))&&(t[e]=n[e])}),t}function S(){var i,e;const t=(e=(i=navigator==null?void 0:navigator.userAgent)==null?void 0:i.toLowerCase)==null?void 0:e.call(i),n={ios:!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/i),android:t.indexOf("android")>-1||t.indexOf("linux")>-1,iPad:t.indexOf("ipad")>-1,wechat:t.indexOf("micromessenger")>-1,aliPay:t.indexOf("alipay")>-1};return{...n,isMobile:n.android||n.ios||n.iPad}}function w(t,n=2){return t.toString().padStart(n,"0")}function O(t,n=[3,7],i="*",e){if(c.isEmpty(t))return"";if(typeof n=="number")return t.slice(0,n)+i.repeat(e||t.length-n);const[r,s]=n;return t.slice(0,r)+i.repeat(t.length-s)+t.slice(s)}const y=function(t,n=2,i=!0,e=","){const r=Number(t);if(l.isNumber(r)){let s="";if(l.isNumber(n))if(i)s=r.toFixed(n).toString();else{let o=String(r).split(".")[1];o=o?o.length:0,o>n&&(o=n),s=r.toFixed(o).toString()}else s=r.toString();const a=s.split(".");return a[0]=a[0].toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+(e||",")),a.join(".")}return t};function E(t,n){const e=h=>h*(Math.PI/180),r=e(t.latitude),s=e(t.longitude),a=e(n.latitude),o=e(n.longitude),f=a-r,g=o-s,d=Math.pow(Math.sin(f/2),2)+Math.cos(r)*Math.cos(a)*Math.pow(Math.sin(g/2),2),u=6371*(2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d))),m=u*1e3;return{km:Number(u.toFixed(2)),m:Math.round(m)}}exports.ObjectAssign=M;exports.browser=S;exports.calculateDistance=E;exports.encryptString=O;exports.isBrowser=p;exports.padZero=w;exports.thousands=y;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./validator.cjs");function v(n,o){return new Promise(t=>{const s=[];n.some(e=>{e.type=e.type??"required";const i=o[e.key],a=!r.validateType[e.type](i,e.len);return a&&s.push(e),a})&&t({valid:!1,...s[0]}),t({valid:!0,msg:void 0,key:void 0})})}function d(n,o){const t=[];return n.some(u=>{const e=o[u.key],i=(!e||e==="undefined")&&e!==0;return i&&t.push(u),i})?{valid:!1,...t[0]}:{valid:!0}}exports.validate=v;exports.validateRequire=d;
|
package/lib/es/index.js
CHANGED
|
@@ -1,76 +1,78 @@
|
|
|
1
1
|
import "./calc/index.js";
|
|
2
2
|
import { WEEK_DAY as t, formatActivityTime as a, formatDate as o, formatIosDate as s, getDateDiff as m, getDateParams as p } from "./day/dayjs.js";
|
|
3
3
|
import { default as l } from "./_virtual/dayjs.min.js";
|
|
4
|
-
import { isArray as d, isBoolean as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
4
|
+
import { isArray as d, isBoolean as x, isDate as u, isFile as c, isFunction as g, isMap as y, isNull as D, isNumber as E, isObject as b, isPromise as j, isRegExp as v, isSet as A, isString as P, isUndefined as S } from "./is/is.js";
|
|
5
|
+
import { isEmpty as h } from "./is/is-empty.js";
|
|
6
|
+
import { depsAreSame as U, isEquals as w } from "./is/is-equals.js";
|
|
7
|
+
import { classnames as F } from "./utils/classnames.js";
|
|
8
|
+
import { deepClone as L } from "./utils/deep-clone.js";
|
|
9
|
+
import { pick as N } from "./utils/pick.js";
|
|
10
|
+
import { filterParams as Q, filterQuery as R, filtrationEmpty as T, getUrlParam as k, json2params as K, padQuery as W, params2json as Y } from "./utils/query2params.js";
|
|
11
|
+
import { ObjectAssign as _, browser as z, calculateDistance as G, encryptString as H, isBrowser as J, padZero as V, thousands as X } from "./utils/util.js";
|
|
12
|
+
import { randomString as rr, uuid as er } from "./utils/uuid.js";
|
|
13
|
+
import { validate as tr, validateRequire as ar } from "./validator/validate.js";
|
|
14
|
+
import { isCard as sr, isCurrency as mr, isEmail as pr, isIdCard as fr, isMobile as lr, isPassport as nr, isUrl as dr, maxLength as xr, minLength as ur, regs as cr, required as gr, validateType as yr, validation as Dr } from "./validator/validator.js";
|
|
15
|
+
import { default as br } from "./calc/calc.js";
|
|
16
|
+
import { Decimal as vr } from "./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
vr as Decimal,
|
|
19
|
+
_ as ObjectAssign,
|
|
19
20
|
t as WEEK_DAY,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
z as browser,
|
|
22
|
+
br as calc,
|
|
23
|
+
G as calculateDistance,
|
|
24
|
+
F as classnames,
|
|
23
25
|
l as dayjs,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
L as deepClone,
|
|
27
|
+
U as depsAreSame,
|
|
28
|
+
H as encryptString,
|
|
29
|
+
Q as filterParams,
|
|
30
|
+
R as filterQuery,
|
|
31
|
+
T as filtrationEmpty,
|
|
29
32
|
a as formatActivityTime,
|
|
30
33
|
o as formatDate,
|
|
31
34
|
s as formatIosDate,
|
|
32
35
|
m as getDateDiff,
|
|
33
36
|
p as getDateParams,
|
|
34
|
-
|
|
37
|
+
k as getUrlParam,
|
|
35
38
|
d as isArray,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
x as isBoolean,
|
|
40
|
+
J as isBrowser,
|
|
41
|
+
sr as isCard,
|
|
42
|
+
mr as isCurrency,
|
|
43
|
+
u as isDate,
|
|
44
|
+
pr as isEmail,
|
|
42
45
|
h as isEmpty,
|
|
43
|
-
|
|
46
|
+
w as isEquals,
|
|
44
47
|
c as isFile,
|
|
45
48
|
g as isFunction,
|
|
46
|
-
|
|
49
|
+
fr as isIdCard,
|
|
47
50
|
y as isMap,
|
|
48
|
-
|
|
51
|
+
lr as isMobile,
|
|
49
52
|
D as isNull,
|
|
50
53
|
E as isNumber,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
cr as
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
_ as validation
|
|
54
|
+
b as isObject,
|
|
55
|
+
nr as isPassport,
|
|
56
|
+
j as isPromise,
|
|
57
|
+
v as isRegExp,
|
|
58
|
+
A as isSet,
|
|
59
|
+
P as isString,
|
|
60
|
+
S as isUndefined,
|
|
61
|
+
dr as isUrl,
|
|
62
|
+
K as json2params,
|
|
63
|
+
xr as maxLength,
|
|
64
|
+
ur as minLength,
|
|
65
|
+
W as padQuery,
|
|
66
|
+
V as padZero,
|
|
67
|
+
Y as params2json,
|
|
68
|
+
N as pick,
|
|
69
|
+
rr as randomString,
|
|
70
|
+
cr as regs,
|
|
71
|
+
gr as required,
|
|
72
|
+
X as thousands,
|
|
73
|
+
er as uuid,
|
|
74
|
+
tr as validate,
|
|
75
|
+
ar as validateRequire,
|
|
76
|
+
yr as validateType,
|
|
77
|
+
Dr as validation
|
|
76
78
|
};
|
package/lib/es/is/is-empty.js
CHANGED
|
@@ -2,5 +2,5 @@ function t(r) {
|
|
|
2
2
|
return !!(r == null || typeof r == "string" && r.trim() === "" || Array.isArray(r) && r.length === 0 || typeof r == "object" && Object.keys(r).length === 0 || typeof r == "number" && r === 0 || typeof r > "u" || r instanceof Map && r.size === 0 || r instanceof Set && r.size === 0);
|
|
3
3
|
}
|
|
4
4
|
export {
|
|
5
|
-
t as
|
|
5
|
+
t as isEmpty
|
|
6
6
|
};
|
package/lib/es/is/is-equals.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function i(r, t) {
|
|
2
2
|
if (r === t)
|
|
3
3
|
return !0;
|
|
4
4
|
if (r === null || t === null)
|
|
@@ -6,23 +6,32 @@ function s(r, t) {
|
|
|
6
6
|
if (Array.isArray(r) && Array.isArray(t)) {
|
|
7
7
|
if (r.length !== t.length)
|
|
8
8
|
return !1;
|
|
9
|
-
for (let
|
|
10
|
-
if (!
|
|
9
|
+
for (let n = 0; n < r.length; n++)
|
|
10
|
+
if (!i(r[n], t[n]))
|
|
11
11
|
return !1;
|
|
12
12
|
return !0;
|
|
13
13
|
}
|
|
14
14
|
if (typeof r != "object" || typeof t != "object")
|
|
15
15
|
return !1;
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
16
|
+
const e = Object.getOwnPropertyNames(r), s = Object.getOwnPropertyNames(t);
|
|
17
|
+
if (e.length !== s.length)
|
|
18
18
|
return !1;
|
|
19
|
-
for (let
|
|
20
|
-
const f = n
|
|
21
|
-
if (!
|
|
19
|
+
for (let n = 0; n < e.length; n++) {
|
|
20
|
+
const f = e[n];
|
|
21
|
+
if (!i(r[f], t[f]))
|
|
22
22
|
return !1;
|
|
23
23
|
}
|
|
24
24
|
return !0;
|
|
25
25
|
}
|
|
26
|
+
function o(r, t) {
|
|
27
|
+
if (r === t)
|
|
28
|
+
return !0;
|
|
29
|
+
for (let e = 0; e < r.length; e++)
|
|
30
|
+
if (!Object.is(r[e], t[e]))
|
|
31
|
+
return !1;
|
|
32
|
+
return !0;
|
|
33
|
+
}
|
|
26
34
|
export {
|
|
27
|
-
|
|
35
|
+
o as depsAreSame,
|
|
36
|
+
i as isEquals
|
|
28
37
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../calc/index.js";
|
|
2
|
+
import "../_virtual/dayjs.min.js";
|
|
3
|
+
import { isObject as i } from "../is/is.js";
|
|
4
|
+
function f(...r) {
|
|
5
|
+
return r.filter((s) => !!s).map((s) => {
|
|
6
|
+
if (i(s)) {
|
|
7
|
+
const t = [];
|
|
8
|
+
Object.keys(s).forEach((o) => {
|
|
9
|
+
s[o] && t.push(o);
|
|
10
|
+
}), s = t.join(" ");
|
|
11
|
+
}
|
|
12
|
+
return s;
|
|
13
|
+
}).join(" ");
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
f as classnames
|
|
17
|
+
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isBrowser as l } from "./util.js";
|
|
2
2
|
import "../calc/index.js";
|
|
3
3
|
import "../_virtual/dayjs.min.js";
|
|
4
4
|
import { isString as d } from "../is/is.js";
|
|
5
|
-
import s from "../is/is-empty.js";
|
|
6
|
-
function f(
|
|
7
|
-
return s(
|
|
5
|
+
import { isEmpty as s } from "../is/is-empty.js";
|
|
6
|
+
function f(r, t = "&") {
|
|
7
|
+
return s(r) ? {} : decodeURIComponent(r).replace(/^\?/, "").split(t).reduce((n, m) => {
|
|
8
8
|
const [o, c] = m.split("=");
|
|
9
9
|
if (o) {
|
|
10
10
|
const u = c ?? "";
|
|
11
|
-
|
|
11
|
+
n[o] && typeof n[o] == "string" ? n[o] = [n[o], u] : n[o] ? n[o].push(u) : n[o] = u;
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return n;
|
|
14
14
|
}, {});
|
|
15
15
|
}
|
|
16
|
-
function p(
|
|
17
|
-
return s(
|
|
18
|
-
const i =
|
|
19
|
-
return Array.isArray(i) ? i.map((
|
|
20
|
-
}).join(
|
|
16
|
+
function p(r, t = "&") {
|
|
17
|
+
return s(r) ? "" : Object.keys(r).map((e) => {
|
|
18
|
+
const i = r[e];
|
|
19
|
+
return Array.isArray(i) ? i.map((n) => `${e}=${n}`).join(t) : `${e}=${i}`;
|
|
20
|
+
}).join(t);
|
|
21
21
|
}
|
|
22
|
-
function q(
|
|
23
|
-
const e = l ? window : { location: { search: "" } }, i = new RegExp("(^|&)" +
|
|
24
|
-
return
|
|
22
|
+
function q(r, t) {
|
|
23
|
+
const e = l ? window : { location: { search: "" } }, i = new RegExp("(^|&)" + r + "=([^&]*)(&|$)"), n = (t || e.location.search).substr(1).match(i);
|
|
24
|
+
return n != null ? unescape(n[2]) : null;
|
|
25
25
|
}
|
|
26
|
-
function a(
|
|
27
|
-
return Object.keys(
|
|
28
|
-
(s(t
|
|
29
|
-
}),
|
|
26
|
+
function a(r) {
|
|
27
|
+
return Object.keys(r).forEach((t) => {
|
|
28
|
+
(s(r[t]) || r[t] === "undefined") && r[t] !== 0 && delete r[t];
|
|
29
|
+
}), r;
|
|
30
30
|
}
|
|
31
|
-
function h(
|
|
32
|
-
const e = d(
|
|
33
|
-
if (s(
|
|
34
|
-
const i = e ? f(
|
|
35
|
-
return
|
|
36
|
-
delete i[
|
|
31
|
+
function h(r, t = []) {
|
|
32
|
+
const e = d(r);
|
|
33
|
+
if (s(r)) return e ? "" : {};
|
|
34
|
+
const i = e ? f(r) : r;
|
|
35
|
+
return t.forEach((n) => {
|
|
36
|
+
delete i[n];
|
|
37
37
|
}), e ? p(i) : i;
|
|
38
38
|
}
|
|
39
|
-
function y(
|
|
40
|
-
if (s(
|
|
41
|
-
|
|
42
|
-
const [e, i] =
|
|
43
|
-
return `${e}?${p(
|
|
39
|
+
function y(r, t) {
|
|
40
|
+
if (s(r)) return "";
|
|
41
|
+
r = decodeURIComponent(r);
|
|
42
|
+
const [e, i] = r.split("?"), n = a(Object.assign({}, f(i), a(Object.assign({}, t || {}))));
|
|
43
|
+
return `${e}?${p(n)}`;
|
|
44
44
|
}
|
|
45
|
-
function O(
|
|
46
|
-
if (s(
|
|
47
|
-
const [e, i = ""] =
|
|
48
|
-
return y(e, f(h(i,
|
|
45
|
+
function O(r, t = []) {
|
|
46
|
+
if (s(r)) return "";
|
|
47
|
+
const [e, i = ""] = r.split("?");
|
|
48
|
+
return y(e, f(h(i, t)));
|
|
49
49
|
}
|
|
50
50
|
export {
|
|
51
51
|
h as filterParams,
|
package/lib/es/utils/util.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "../calc/index.js";
|
|
2
2
|
import "../_virtual/dayjs.min.js";
|
|
3
3
|
import { isNumber as f } from "../is/is.js";
|
|
4
|
-
import c from "../is/is-empty.js";
|
|
5
|
-
const x = typeof window
|
|
6
|
-
function
|
|
4
|
+
import { isEmpty as c } from "../is/is-empty.js";
|
|
5
|
+
const x = !!(typeof window < "u" && window.document && window.document.createElement);
|
|
6
|
+
function A(t, n, e) {
|
|
7
7
|
return c(t) || c(n) || Object.keys(t).forEach((i) => {
|
|
8
8
|
n[i] !== void 0 && !(e != null && e.includes(i)) && (t[i] = n[i]);
|
|
9
9
|
}), t;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function E() {
|
|
12
12
|
var e, i;
|
|
13
13
|
const t = (i = (e = navigator == null ? void 0 : navigator.userAgent) == null ? void 0 : e.toLowerCase) == null ? void 0 : i.call(e), n = {
|
|
14
14
|
ios: !!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/i),
|
|
@@ -22,10 +22,10 @@ function P() {
|
|
|
22
22
|
isMobile: n.android || n.ios || n.iPad
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function P(t, n = 2) {
|
|
26
26
|
return t.toString().padStart(n, "0");
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function R(t, n = [3, 7], e = "*", i) {
|
|
29
29
|
if (c(t)) return "";
|
|
30
30
|
if (typeof n == "number")
|
|
31
31
|
return t.slice(0, n) + e.repeat(i || t.length - n);
|
|
@@ -50,22 +50,21 @@ const U = function(t, n = 2, e = !0, i = ",") {
|
|
|
50
50
|
}
|
|
51
51
|
return t;
|
|
52
52
|
};
|
|
53
|
-
function
|
|
54
|
-
const i = (
|
|
53
|
+
function y(t, n) {
|
|
54
|
+
const i = (h) => h * (Math.PI / 180), o = i(t.latitude), r = i(t.longitude), s = i(n.latitude), a = i(n.longitude), m = s - o, l = a - r, d = Math.pow(Math.sin(m / 2), 2) + Math.cos(o) * Math.cos(s) * Math.pow(Math.sin(l / 2), 2), u = 6371 * (2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d))), g = u * 1e3;
|
|
55
55
|
return {
|
|
56
56
|
km: Number(u.toFixed(2)),
|
|
57
57
|
// 保留两位小数
|
|
58
|
-
m: Math.round(
|
|
58
|
+
m: Math.round(g)
|
|
59
59
|
// 四舍五入到整数
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
y as padZero,
|
|
63
|
+
A as ObjectAssign,
|
|
64
|
+
E as browser,
|
|
65
|
+
y as calculateDistance,
|
|
66
|
+
R as encryptString,
|
|
67
|
+
x as isBrowser,
|
|
68
|
+
P as padZero,
|
|
70
69
|
U as thousands
|
|
71
70
|
};
|
package/lib/types/is/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './is';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export * from './is-empty';
|
|
3
|
+
export * from './is-equals';
|
|
@@ -7,5 +7,13 @@
|
|
|
7
7
|
* const a = { a: 1 }; const b = { a: 1 };
|
|
8
8
|
* isEquals(a) => true
|
|
9
9
|
*/
|
|
10
|
-
declare function isEquals(value1: any, value2: any): boolean;
|
|
11
|
-
|
|
10
|
+
export declare function isEquals(value1: any, value2: any): boolean;
|
|
11
|
+
type DependencyList = readonly unknown[];
|
|
12
|
+
/**
|
|
13
|
+
* 判断依赖项是否相同-浅比较
|
|
14
|
+
* @param oldDeps 旧的依赖项
|
|
15
|
+
* @param newDeps 新的依赖项
|
|
16
|
+
* @returns 是否相同
|
|
17
|
+
*/
|
|
18
|
+
export declare function depsAreSame(oldDeps: DependencyList, newDeps: DependencyList): boolean;
|
|
19
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./_commonjsHelpers.js"),r=require("../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js");var t=r.__require();const s=e.getDefaultExportFromCjs(t);exports.default=s;
|
package/lib/cjs/calc/calc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js"),l={add:function(t,e){return new i.Decimal(t).add(new i.Decimal(e)).toNumber()},subtract:function(t,e){return new i.Decimal(t).sub(new i.Decimal(e)).toNumber()},multiply:function(t,e){return new i.Decimal(t).mul(new i.Decimal(e)).toNumber()},divide:function(t,e){return new i.Decimal(t).div(new i.Decimal(e)).toNumber()},saveCeilFloat:(t,e=2)=>l.divide(Math.ceil(l.multiply(t,Math.pow(10,e))),Math.pow(10,e)).toFixedNew(e)};exports.default=l;
|
package/lib/cjs/calc/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./calc.js"),i=require("../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js");Number.prototype.toFixedNew=function(t){let e=this;return e<0?(e=e*-1,(Math.round(o.default.multiply(e,Math.pow(10,t)))/Math.pow(10,t)*-1).toFixed(t)):(Math.round(o.default.multiply(e,Math.pow(10,t)))/Math.pow(10,t)).toFixed(t)};Number.prototype.countDecimals=function(){return Math.floor(this.valueOf())===this.valueOf()?0:this.toString().split(".")[1].length||0};exports.calc=o.default;exports.Decimal=i.Decimal;
|
package/lib/cjs/day/dayjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../_virtual/dayjs.min.js");require("../calc/index.js");const c=require("../utils/util.js");function m(r){return r.replace(/\-/g,"/")}function d(r,e){const t=l.default(r);e===void 0&&(e="yyyy-MM-dd HH:mm:ss");const a={"M+":t.month()+1,"d+":t.date(),"h+":t.hour()%12===0?12:t.hour()%12,"H+":t.hour(),"m+":t.minute(),"s+":t.second(),"q+":Math.floor((t.month()+3)/3),S:t.millisecond()},o={0:"日",1:"一",2:"二",3:"三",4:"四",5:"五",6:"六"};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.year()+"").substr(4-RegExp.$1.length))),/(E+)/.test(e)&&(e=e.replace(RegExp.$1,(RegExp.$1.length>1?RegExp.$1.length>2?"星期":"周":"")+o[t.day()+""]));for(const n in a)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,RegExp.$1.length===1?a[n]:("00"+a[n]).substr((""+a[n]).length)));return e}const i=["日","一","二","三","四","五","六"];function f(r){const e=l.default(r),t={y:e.year()+"",m:e.month()+1+"",d:e.date()+"",h:e.hour()+"",mm:e.minute()+"",ss:e.second()+"",w:i[e.day()]};for(const a in t)Object.hasOwnProperty.call(t,a)&&!["y","w"].includes(a)&&(t[a]=c.padZero(t[a]));return t}function g(r){const e=l.default(r).valueOf(),t=l.default().valueOf(),a=t-e;if(a<0)return"未来的时间";const o=[{label:"年",value:365*24*60*60*1e3},{label:"月",value:720*60*60*1e3},{label:"周",value:10080*60*1e3},{label:"天",value:1440*60*1e3},{label:"小时",value:3600*1e3},{label:"分钟",value:60*1e3},{label:"刚刚",value:10*1e3}];if(a<o[o.length-1].value)return"刚刚";for(const{label:n,value:u}of o.slice(0,-1)){const s=a/u;if(s>=1)return n==="天"&&s<2?s===1?"昨天":"今天":`${Math.floor(s)} ${n}前`}return"刚刚"}function D(r,e){if(!r)return"";const t=l.default(r),{m:a,d:o,w:n}=f(r);if(e){const u=l.default(e);return t.format("YYYY-MM-DD")===u.format("YYYY-MM-DD")?`${a}月${o}日 周${n} ${t.format("HH:mm")}-${u.format("HH:mm")}`:`${t.format("MM月DD日 HH:mm")} - ${u.format("MM月DD日 HH:mm")}`}else return`${a}月${o}日 周${n} ${t.format("HH:mm")}`}exports.WEEK_DAY=i;exports.formatActivityTime=D;exports.formatDate=d;exports.formatIosDate=m;exports.getDateDiff=g;exports.getDateParams=f;
|
package/lib/cjs/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./calc/index.js");const a=require("./day/dayjs.js"),o=require("./_virtual/dayjs.min.js"),e=require("./is/is.js"),l=require("./is/is-empty.js"),u=require("./is/is-equals.js"),t=require("./validator/validate.js"),i=require("./validator/validator.js"),d=require("./utils/deep-clone.js"),c=require("./utils/pick.js"),s=require("./utils/query2params.js"),r=require("./utils/util.js"),n=require("./utils/uuid.js"),m=require("./calc/calc.js"),p=require("./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js");exports.WEEK_DAY=a.WEEK_DAY;exports.formatActivityTime=a.formatActivityTime;exports.formatDate=a.formatDate;exports.formatIosDate=a.formatIosDate;exports.getDateDiff=a.getDateDiff;exports.getDateParams=a.getDateParams;exports.dayjs=o.default;exports.isArray=e.isArray;exports.isBoolean=e.isBoolean;exports.isDate=e.isDate;exports.isFile=e.isFile;exports.isFunction=e.isFunction;exports.isMap=e.isMap;exports.isNull=e.isNull;exports.isNumber=e.isNumber;exports.isObject=e.isObject;exports.isPromise=e.isPromise;exports.isRegExp=e.isRegExp;exports.isSet=e.isSet;exports.isString=e.isString;exports.isUndefined=e.isUndefined;exports.isEmpty=l.default;exports.isEquals=u.default;exports.validate=t.validate;exports.validateRequire=t.validateRequire;exports.isCard=i.isCard;exports.isCurrency=i.isCurrency;exports.isEmail=i.isEmail;exports.isIdCard=i.isIdCard;exports.isMobile=i.isMobile;exports.isPassport=i.isPassport;exports.isUrl=i.isUrl;exports.maxLength=i.maxLength;exports.minLength=i.minLength;exports.regs=i.regs;exports.required=i.required;exports.validateType=i.validateType;exports.validation=i.validation;exports.deepClone=d.deepClone;exports.pick=c.pick;exports.filterParams=s.filterParams;exports.filterQuery=s.filterQuery;exports.filtrationEmpty=s.filtrationEmpty;exports.getUrlParam=s.getUrlParam;exports.json2params=s.json2params;exports.padQuery=s.padQuery;exports.params2json=s.params2json;exports.ObjectAssign=r.ObjectAssign;exports.browser=r.browser;exports.calculateDistance=r.calculateDistance;exports.encryptString=r.encryptString;exports.isClient=r.isClient;exports.isSSR=r.isSSR;exports.padZero=r.padZero;exports.thousands=r.thousands;exports.randomString=n.randomString;exports.uuid=n.uuid;exports.calc=m.default;exports.Decimal=p.Decimal;
|
package/lib/cjs/is/is-empty.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function r(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&Object.keys(t).length===0||typeof t=="number"&&t===0||typeof t>"u"||t instanceof Map&&t.size===0||t instanceof Set&&t.size===0)}exports.default=r;
|
package/lib/cjs/is/is-equals.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function f(r,t){if(r===t)return!0;if(r===null||t===null)return!1;if(Array.isArray(r)&&Array.isArray(t)){if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(!f(r[e],t[e]))return!1;return!0}if(typeof r!="object"||typeof t!="object")return!1;const n=Object.getOwnPropertyNames(r),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let e=0;e<n.length;e++){const s=n[e];if(!f(r[s],t[s]))return!1}return!0}exports.default=f;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../../../../../_virtual/dayjs.min2.js");var G=C.__module.exports,V;function K(){return V||(V=1,(function(P,X){(function(A,k){P.exports=k()})(G,(function(){var A=1e3,k=6e4,U=36e5,I="millisecond",p="second",_="minute",w="hour",M="day",H="week",m="month",F="quarter",y="year",O="date",J="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,E=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Q={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(i){var n=["th","st","nd","rd"],t=i%100;return"["+i+(n[(t-20)%10]||n[t]||n[0])+"]"}},q=function(i,n,t){var r=String(i);return!r||r.length>=n?i:""+Array(n+1-r.length).join(t)+i},R={s:q,z:function(i){var n=-i.utcOffset(),t=Math.abs(n),r=Math.floor(t/60),e=t%60;return(n<=0?"+":"-")+q(r,2,"0")+":"+q(e,2,"0")},m:function i(n,t){if(n.date()<t.date())return-i(t,n);var r=12*(t.year()-n.year())+(t.month()-n.month()),e=n.clone().add(r,m),s=t-e<0,u=n.clone().add(r+(s?-1:1),m);return+(-(r+(t-e)/(s?e-u:u-e))||0)},a:function(i){return i<0?Math.ceil(i)||0:Math.floor(i)},p:function(i){return{M:m,y,w:H,d:M,D:O,h:w,m:_,s:p,ms:I,Q:F}[i]||String(i||"").toLowerCase().replace(/s$/,"")},u:function(i){return i===void 0}},x="en",D={};D[x]=Q;var Z="$isDayjsObject",N=function(i){return i instanceof L||!(!i||!i[Z])},j=function i(n,t,r){var e;if(!n)return x;if(typeof n=="string"){var s=n.toLowerCase();D[s]&&(e=s),t&&(D[s]=t,e=s);var u=n.split("-");if(!e&&u.length>1)return i(u[0])}else{var o=n.name;D[o]=n,e=o}return!r&&e&&(x=e),e||!r&&x},f=function(i,n){if(N(i))return i.clone();var t=typeof n=="object"?n:{};return t.date=i,t.args=arguments,new L(t)},a=R;a.l=j,a.i=N,a.w=function(i,n){return f(i,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var L=(function(){function i(t){this.$L=j(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[Z]=!0}var n=i.prototype;return n.parse=function(t){this.$d=(function(r){var e=r.date,s=r.utc;if(e===null)return new Date(NaN);if(a.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var u=e.match(B);if(u){var o=u[2]-1||0,c=(u[7]||"0").substring(0,3);return s?new Date(Date.UTC(u[1],o,u[3]||1,u[4]||0,u[5]||0,u[6]||0,c)):new Date(u[1],o,u[3]||1,u[4]||0,u[5]||0,u[6]||0,c)}}return new Date(e)})(t),this.init()},n.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},n.$utils=function(){return a},n.isValid=function(){return this.$d.toString()!==J},n.isSame=function(t,r){var e=f(t);return this.startOf(r)<=e&&e<=this.endOf(r)},n.isAfter=function(t,r){return f(t)<this.startOf(r)},n.isBefore=function(t,r){return this.endOf(r)<f(t)},n.$g=function(t,r,e){return a.u(t)?this[r]:this.set(e,t)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(t,r){var e=this,s=!!a.u(r)||r,u=a.p(t),o=function(S,$){var v=a.w(e.$u?Date.UTC(e.$y,$,S):new Date(e.$y,$,S),e);return s?v:v.endOf(M)},c=function(S,$){return a.w(e.toDate()[S].apply(e.toDate("s"),(s?[0,0,0,0]:[23,59,59,999]).slice($)),e)},h=this.$W,d=this.$M,l=this.$D,b="set"+(this.$u?"UTC":"");switch(u){case y:return s?o(1,0):o(31,11);case m:return s?o(1,d):o(0,d+1);case H:var g=this.$locale().weekStart||0,T=(h<g?h+7:h)-g;return o(s?l-T:l+(6-T),d);case M:case O:return c(b+"Hours",0);case w:return c(b+"Minutes",1);case _:return c(b+"Seconds",2);case p:return c(b+"Milliseconds",3);default:return this.clone()}},n.endOf=function(t){return this.startOf(t,!1)},n.$set=function(t,r){var e,s=a.p(t),u="set"+(this.$u?"UTC":""),o=(e={},e[M]=u+"Date",e[O]=u+"Date",e[m]=u+"Month",e[y]=u+"FullYear",e[w]=u+"Hours",e[_]=u+"Minutes",e[p]=u+"Seconds",e[I]=u+"Milliseconds",e)[s],c=s===M?this.$D+(r-this.$W):r;if(s===m||s===y){var h=this.clone().set(O,1);h.$d[o](c),h.init(),this.$d=h.set(O,Math.min(this.$D,h.daysInMonth())).$d}else o&&this.$d[o](c);return this.init(),this},n.set=function(t,r){return this.clone().$set(t,r)},n.get=function(t){return this[a.p(t)]()},n.add=function(t,r){var e,s=this;t=Number(t);var u=a.p(r),o=function(d){var l=f(s);return a.w(l.date(l.date()+Math.round(d*t)),s)};if(u===m)return this.set(m,this.$M+t);if(u===y)return this.set(y,this.$y+t);if(u===M)return o(1);if(u===H)return o(7);var c=(e={},e[_]=k,e[w]=U,e[p]=A,e)[u]||1,h=this.$d.getTime()+t*c;return a.w(h,this)},n.subtract=function(t,r){return this.add(-1*t,r)},n.format=function(t){var r=this,e=this.$locale();if(!this.isValid())return e.invalidDate||J;var s=t||"YYYY-MM-DDTHH:mm:ssZ",u=a.z(this),o=this.$H,c=this.$m,h=this.$M,d=e.weekdays,l=e.months,b=e.meridiem,g=function($,v,Y,W){return $&&($[v]||$(r,s))||Y[v].slice(0,W)},T=function($){return a.s(o%12||12,$,"0")},S=b||function($,v,Y){var W=$<12?"AM":"PM";return Y?W.toLowerCase():W};return s.replace(E,(function($,v){return v||(function(Y){switch(Y){case"YY":return String(r.$y).slice(-2);case"YYYY":return a.s(r.$y,4,"0");case"M":return h+1;case"MM":return a.s(h+1,2,"0");case"MMM":return g(e.monthsShort,h,l,3);case"MMMM":return g(l,h);case"D":return r.$D;case"DD":return a.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return g(e.weekdaysMin,r.$W,d,2);case"ddd":return g(e.weekdaysShort,r.$W,d,3);case"dddd":return d[r.$W];case"H":return String(o);case"HH":return a.s(o,2,"0");case"h":return T(1);case"hh":return T(2);case"a":return S(o,c,!0);case"A":return S(o,c,!1);case"m":return String(c);case"mm":return a.s(c,2,"0");case"s":return String(r.$s);case"ss":return a.s(r.$s,2,"0");case"SSS":return a.s(r.$ms,3,"0");case"Z":return u}return null})($)||u.replace(":","")}))},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var s,u=this,o=a.p(r),c=f(t),h=(c.utcOffset()-this.utcOffset())*k,d=this-c,l=function(){return a.m(u,c)};switch(o){case y:s=l()/12;break;case m:s=l();break;case F:s=l()/3;break;case H:s=(d-h)/6048e5;break;case M:s=(d-h)/864e5;break;case w:s=d/U;break;case _:s=d/k;break;case p:s=d/A;break;default:s=d}return e?s:a.a(s)},n.daysInMonth=function(){return this.endOf(m).$D},n.$locale=function(){return D[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),s=j(t,r,!0);return s&&(e.$L=s),e},n.clone=function(){return a.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},i})(),z=L.prototype;return f.prototype=z,[["$ms",I],["$s",p],["$m",_],["$H",w],["$W",M],["$M",m],["$y",y],["$D",O]].forEach((function(i){z[i[1]]=function(n){return this.$g(n,i[0],i[1])}})),f.extend=function(i,n){return i.$i||(i(n,L,f),i.$i=!0),f},f.locale=j,f.isDayjs=N,f.unix=function(i){return f(1e3*i)},f.en=D[x],f.Ls=D,f.p={},f}))})(C.__module)),C.__module.exports}exports.__require=K;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./util.js");require("../calc/index.js");require("../_virtual/dayjs.min.js");const g=require("../is/is.js"),u=require("../is/is-empty.js");function a(e,t="&"){return u.default(e)?{}:decodeURIComponent(e).replace(/^\?/,"").split(t).reduce((r,d)=>{const[s,m]=d.split("=");if(s){const o=m??"";r[s]&&typeof r[s]=="string"?r[s]=[r[s],o]:r[s]?r[s].push(o):r[s]=o}return r},{})}function l(e,t="&"){return u.default(e)?"":Object.keys(e).map(n=>{const i=e[n];return Array.isArray(i)?i.map(r=>`${n}=${r}`).join(t):`${n}=${i}`}).join(t)}function h(e,t){const n=y.isClient?window:{location:{search:""}},i=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),r=(t||n.location.search).substr(1).match(i);return r!=null?unescape(r[2]):null}function f(e){return Object.keys(e).forEach(t=>{(u.default(e[t])||e[t]==="undefined")&&e[t]!==0&&delete e[t]}),e}function c(e,t=[]){const n=g.isString(e);if(u.default(e))return n?"":{};const i=n?a(e):e;return t.forEach(r=>{delete i[r]}),n?l(i):i}function p(e,t){if(u.default(e))return"";e=decodeURIComponent(e);const[n,i]=e.split("?"),r=f(Object.assign({},a(i),f(Object.assign({},t||{}))));return`${n}?${l(r)}`}function q(e,t=[]){if(u.default(e))return"";const[n,i=""]=e.split("?");return p(n,a(c(i,t)))}exports.filterParams=c;exports.filterQuery=q;exports.filtrationEmpty=f;exports.getUrlParam=h;exports.json2params=l;exports.padQuery=p;exports.params2json=a;
|
package/lib/cjs/utils/util.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../calc/index.js");require("../_virtual/dayjs.min.js");const l=require("../is/is.js"),c=require("../is/is-empty.js"),p=typeof window>"u",m=typeof window<"u";function M(t,n,i){return c.default(t)||c.default(n)||Object.keys(t).forEach(e=>{n[e]!==void 0&&!(i!=null&&i.includes(e))&&(t[e]=n[e])}),t}function w(){var i,e;const t=(e=(i=navigator==null?void 0:navigator.userAgent)==null?void 0:i.toLowerCase)==null?void 0:e.call(i),n={ios:!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/i),android:t.indexOf("android")>-1||t.indexOf("linux")>-1,iPad:t.indexOf("ipad")>-1,wechat:t.indexOf("micromessenger")>-1,aliPay:t.indexOf("alipay")>-1};return{...n,isMobile:n.android||n.ios||n.iPad}}function O(t,n=2){return t.toString().padStart(n,"0")}function y(t,n=[3,7],i="*",e){if(c.default(t))return"";if(typeof n=="number")return t.slice(0,n)+i.repeat(e||t.length-n);const[r,s]=n;return t.slice(0,r)+i.repeat(t.length-s)+t.slice(s)}const A=function(t,n=2,i=!0,e=","){const r=Number(t);if(l.isNumber(r)){let s="";if(l.isNumber(n))if(i)s=r.toFixed(n).toString();else{let a=String(r).split(".")[1];a=a?a.length:0,a>n&&(a=n),s=r.toFixed(a).toString()}else s=r.toString();const o=s.split(".");return o[0]=o[0].toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+(e||",")),o.join(".")}return t};function R(t,n){const e=S=>S*(Math.PI/180),r=e(t.latitude),s=e(t.longitude),o=e(n.latitude),a=e(n.longitude),f=o-r,g=a-s,d=Math.pow(Math.sin(f/2),2)+Math.cos(r)*Math.cos(o)*Math.pow(Math.sin(g/2),2),u=6371*(2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d))),h=u*1e3;return{km:Number(u.toFixed(2)),m:Math.round(h)}}exports.ObjectAssign=M;exports.browser=w;exports.calculateDistance=R;exports.encryptString=y;exports.isClient=m;exports.isSSR=p;exports.padZero=O;exports.thousands=A;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./validator.js");function v(n,o){return new Promise(t=>{const s=[];n.some(e=>{e.type=e.type??"required";const i=o[e.key],a=!r.validateType[e.type](i,e.len);return a&&s.push(e),a})&&t({valid:!1,...s[0]}),t({valid:!0,msg:void 0,key:void 0})})}function d(n,o){const t=[];return n.some(u=>{const e=o[u.key],i=(!e||e==="undefined")&&e!==0;return i&&t.push(u),i})?{valid:!1,...t[0]}:{valid:!0}}exports.validate=v;exports.validateRequire=d;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|