@spacego/turbo-utils 0.0.1-alpha → 0.0.1-alpha.1

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.
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../_virtual/dayjs.min.js"),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 CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./calc/calc.js"),u=require("./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js"),c=require("./_virtual/dayjs.min.js"),a=require("./day/dayjs.js"),e=require("./is/is.js"),d=require("./is/is-empty.js"),t=require("./is/is-equals.js"),m=require("./utils/classnames.js"),p=require("./utils/deep-clone.js"),y=require("./utils/pick.js"),s=require("./utils/query2params.js"),r=require("./utils/util.js"),n=require("./utils/uuid.js"),o=require("./validator/validate.js"),i=require("./validator/validator.js");exports.calc=l.default;exports.Decimal=u.Decimal;exports.dayjs=c.default;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.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=d.isEmpty;exports.depsAreSame=t.depsAreSame;exports.isEquals=t.isEquals;exports.classnames=m.classnames;exports.deepClone=p.deepClone;exports.pick=y.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;
@@ -1 +1 @@
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;
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;
@@ -1 +1 @@
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
+ "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 i=require("../is/is.js");function r(...c){return c.filter(s=>!!s).map(s=>{if(i.isObject(s)){const e=[];Object.keys(s).forEach(t=>{s[t]&&e.push(t)}),s=e.join(" ")}return s}).join(" ")}exports.classnames=r;
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./util.js"),E=require("../is/is.js"),o=require("../is/is-empty.js");function u(t,e="&"){return o.isEmpty(t)?{}:decodeURIComponent(t).replace(/^\?/,"").split(e).reduce((r,m)=>{const[s,y]=m.split("=");if(s){const a=y??"";r[s]&&typeof r[s]=="string"?r[s]=[r[s],a]:r[s]?r[s].push(a):r[s]=a}return r},{})}function p(t,e="&"){return o.isEmpty(t)?"":Object.keys(t).map(n=>{const i=t[n];return Array.isArray(i)?i.map(r=>`${n}=${r}`).join(e):`${n}=${i}`}).join(e)}function g(t,e){const n=d.isBrowser?window:{location:{search:""}},i=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),r=(e||n.location.search).substr(1).match(i);return r!=null?unescape(r[2]):null}function f(t){return Object.keys(t).forEach(e=>{(o.isEmpty(t[e])||t[e]==="undefined")&&t[e]!==0&&delete t[e]}),t}function c(t,e=[]){const n=E.isString(t);if(o.isEmpty(t))return n?"":{};const i=n?u(t):t;return e.forEach(r=>{delete i[r]}),n?p(i):i}function l(t,e){if(o.isEmpty(t))return"";t=decodeURIComponent(t);const[n,i]=t.split("?"),r=f(Object.assign({},u(i),f(Object.assign({},e||{}))));return`${n}?${p(r)}`}function h(t,e=[]){if(o.isEmpty(t))return"";const[n,i=""]=t.split("?");return l(n,u(c(i,e)))}exports.filterParams=c;exports.filterQuery=h;exports.filtrationEmpty=f;exports.getUrlParam=g;exports.json2params=p;exports.padQuery=l;exports.params2json=u;
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../is/is-empty.js"),l=require("../is/is.js"),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;
@@ -1,11 +1,10 @@
1
1
  import l from "../_virtual/dayjs.min.js";
2
- import "../calc/index.js";
3
2
  import { padZero as i } from "../utils/util.js";
4
- function p(o) {
5
- return o.replace(/\-/g, "/");
3
+ function $(n) {
4
+ return n.replace(/\-/g, "/");
6
5
  }
7
- function h(o, e) {
8
- const t = l(o);
6
+ function h(n, e) {
7
+ const t = l(n);
9
8
  e === void 0 && (e = "yyyy-MM-dd HH:mm:ss");
10
9
  const r = {
11
10
  "M+": t.month() + 1,
@@ -37,16 +36,16 @@ function h(o, e) {
37
36
  RegExp.$1,
38
37
  (RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "星期" : "周" : "") + a[t.day() + ""]
39
38
  ));
40
- for (const n in r)
41
- new RegExp("(" + n + ")").test(e) && (e = e.replace(
39
+ for (const o in r)
40
+ new RegExp("(" + o + ")").test(e) && (e = e.replace(
42
41
  RegExp.$1,
43
- RegExp.$1.length === 1 ? r[n] : ("00" + r[n]).substr(("" + r[n]).length)
42
+ RegExp.$1.length === 1 ? r[o] : ("00" + r[o]).substr(("" + r[o]).length)
44
43
  ));
45
44
  return e;
46
45
  }
47
46
  const f = ["日", "一", "二", "三", "四", "五", "六"];
48
- function c(o) {
49
- const e = l(o), t = {
47
+ function c(n) {
48
+ const e = l(n), t = {
50
49
  /* 年 */
51
50
  y: e.year() + "",
52
51
  /** 月 */
@@ -66,8 +65,8 @@ function c(o) {
66
65
  Object.hasOwnProperty.call(t, r) && !["y", "w"].includes(r) && (t[r] = i(t[r]));
67
66
  return t;
68
67
  }
69
- function g(o) {
70
- const e = l(o).valueOf(), t = l().valueOf(), r = t - e;
68
+ function p(n) {
69
+ const e = l(n).valueOf(), t = l().valueOf(), r = t - e;
71
70
  if (r < 0) return "未来的时间";
72
71
  const a = [
73
72
  { label: "年", value: 365 * 24 * 60 * 60 * 1e3 },
@@ -79,27 +78,27 @@ function g(o) {
79
78
  { label: "刚刚", value: 10 * 1e3 }
80
79
  ];
81
80
  if (r < a[a.length - 1].value) return "刚刚";
82
- for (const { label: n, value: u } of a.slice(0, -1)) {
81
+ for (const { label: o, value: u } of a.slice(0, -1)) {
83
82
  const s = r / u;
84
83
  if (s >= 1)
85
- return n === "天" && s < 2 ? s === 1 ? "昨天" : "今天" : `${Math.floor(s)} ${n}前`;
84
+ return o === "天" && s < 2 ? s === 1 ? "昨天" : "今天" : `${Math.floor(s)} ${o}前`;
86
85
  }
87
86
  return "刚刚";
88
87
  }
89
- function y(o, e) {
90
- if (!o) return "";
91
- const t = l(o), { m: r, d: a, w: n } = c(o);
88
+ function g(n, e) {
89
+ if (!n) return "";
90
+ const t = l(n), { m: r, d: a, w: o } = c(n);
92
91
  if (e) {
93
92
  const u = l(e);
94
- return t.format("YYYY-MM-DD") === u.format("YYYY-MM-DD") ? `${r}月${a}日 周${n} ${t.format("HH:mm")}-${u.format("HH:mm")}` : `${t.format("MM月DD日 HH:mm")} - ${u.format("MM月DD日 HH:mm")}`;
93
+ return t.format("YYYY-MM-DD") === u.format("YYYY-MM-DD") ? `${r}月${a}日 周${o} ${t.format("HH:mm")}-${u.format("HH:mm")}` : `${t.format("MM月DD日 HH:mm")} - ${u.format("MM月DD日 HH:mm")}`;
95
94
  } else
96
- return `${r}月${a}日 周${n} ${t.format("HH:mm")}`;
95
+ return `${r}月${a}日 周${o} ${t.format("HH:mm")}`;
97
96
  }
98
97
  export {
99
98
  f as WEEK_DAY,
100
- y as formatActivityTime,
99
+ g as formatActivityTime,
101
100
  h as formatDate,
102
- p as formatIosDate,
103
- g as getDateDiff,
101
+ $ as formatIosDate,
102
+ p as getDateDiff,
104
103
  c as getDateParams
105
104
  };
package/lib/es/index.js CHANGED
@@ -1,76 +1,77 @@
1
- import "./calc/index.js";
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
- import { default as l } from "./_virtual/dayjs.min.js";
4
- import { isArray as d, isBoolean as u, isDate as x, isFile as c, isFunction as g, isMap as y, isNull as D, isNumber as E, isObject as S, isPromise as b, isRegExp as j, isSet as v, isString as C, isUndefined as P } from "./is/is.js";
5
- import { default as h } from "./is/is-empty.js";
6
- import { default as R } from "./is/is-equals.js";
7
- import { validate as F, validateRequire as I } from "./validator/validate.js";
8
- import { isCard as M, isCurrency as N, isEmail as O, isIdCard as Q, isMobile as T, isPassport as k, isUrl as w, maxLength as B, minLength as K, regs as W, required as Y, validateType as Z, validation as _ } from "./validator/validator.js";
9
- import { deepClone as G } from "./utils/deep-clone.js";
10
- import { pick as J } from "./utils/pick.js";
11
- import { filterParams as X, filterQuery as $, filtrationEmpty as rr, getUrlParam as er, json2params as ir, padQuery as tr, params2json as ar } from "./utils/query2params.js";
12
- import { ObjectAssign as sr, browser as mr, calculateDistance as pr, encryptString as fr, isClient as lr, isSSR as nr, padZero as dr, thousands as ur } from "./utils/util.js";
13
- import { randomString as cr, uuid as gr } from "./utils/uuid.js";
14
- import { default as Dr } from "./calc/calc.js";
15
- import { Decimal as Sr } from "./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
1
+ import { default as i } from "./calc/calc.js";
2
+ import { Decimal as a } from "./node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
3
+ import { default as s } from "./_virtual/dayjs.min.js";
4
+ import { WEEK_DAY as p, formatActivityTime as f, formatDate as l, formatIosDate as n, getDateDiff as d, getDateParams as x } from "./day/dayjs.js";
5
+ import { isArray as c, isBoolean as g, isDate as y, isFile as D, isFunction as E, isMap as b, isNull as j, isNumber as v, isObject as A, isPromise as P, isRegExp as S, isSet as C, isString as h, isUndefined as q } from "./is/is.js";
6
+ import { isEmpty as w } from "./is/is-empty.js";
7
+ import { depsAreSame as F, isEquals as I } from "./is/is-equals.js";
8
+ import { classnames as M } from "./utils/classnames.js";
9
+ import { deepClone as O } from "./utils/deep-clone.js";
10
+ import { pick as R } from "./utils/pick.js";
11
+ import { filterParams as k, filterQuery as K, filtrationEmpty as W, getUrlParam as Y, json2params as Z, padQuery as _, params2json as z } from "./utils/query2params.js";
12
+ import { ObjectAssign as H, browser as J, calculateDistance as V, encryptString as X, isBrowser as $, padZero as rr, thousands as er } from "./utils/util.js";
13
+ import { randomString as tr, uuid as ar } from "./utils/uuid.js";
14
+ import { validate as sr, validateRequire as mr } from "./validator/validate.js";
15
+ import { isCard as fr, isCurrency as lr, isEmail as nr, isIdCard as dr, isMobile as xr, isPassport as ur, isUrl as cr, maxLength as gr, minLength as yr, regs as Dr, required as Er, validateType as br, validation as jr } from "./validator/validator.js";
16
16
  export {
17
- Sr as Decimal,
18
- sr as ObjectAssign,
19
- t as WEEK_DAY,
20
- mr as browser,
21
- Dr as calc,
22
- pr as calculateDistance,
23
- l as dayjs,
24
- G as deepClone,
25
- fr as encryptString,
26
- X as filterParams,
27
- $ as filterQuery,
28
- rr as filtrationEmpty,
29
- a as formatActivityTime,
30
- o as formatDate,
31
- s as formatIosDate,
32
- m as getDateDiff,
33
- p as getDateParams,
34
- er as getUrlParam,
35
- d as isArray,
36
- u as isBoolean,
37
- M as isCard,
38
- lr as isClient,
39
- N as isCurrency,
40
- x as isDate,
41
- O as isEmail,
42
- h as isEmpty,
43
- R as isEquals,
44
- c as isFile,
45
- g as isFunction,
46
- Q as isIdCard,
47
- y as isMap,
48
- T as isMobile,
49
- D as isNull,
50
- E as isNumber,
51
- S as isObject,
52
- k as isPassport,
53
- b as isPromise,
54
- j as isRegExp,
55
- nr as isSSR,
56
- v as isSet,
57
- C as isString,
58
- P as isUndefined,
59
- w as isUrl,
60
- ir as json2params,
61
- B as maxLength,
62
- K as minLength,
63
- tr as padQuery,
64
- dr as padZero,
65
- ar as params2json,
66
- J as pick,
67
- cr as randomString,
68
- W as regs,
69
- Y as required,
70
- ur as thousands,
71
- gr as uuid,
72
- F as validate,
73
- I as validateRequire,
74
- Z as validateType,
75
- _ as validation
17
+ a as Decimal,
18
+ H as ObjectAssign,
19
+ p as WEEK_DAY,
20
+ J as browser,
21
+ i as calc,
22
+ V as calculateDistance,
23
+ M as classnames,
24
+ s as dayjs,
25
+ O as deepClone,
26
+ F as depsAreSame,
27
+ X as encryptString,
28
+ k as filterParams,
29
+ K as filterQuery,
30
+ W as filtrationEmpty,
31
+ f as formatActivityTime,
32
+ l as formatDate,
33
+ n as formatIosDate,
34
+ d as getDateDiff,
35
+ x as getDateParams,
36
+ Y as getUrlParam,
37
+ c as isArray,
38
+ g as isBoolean,
39
+ $ as isBrowser,
40
+ fr as isCard,
41
+ lr as isCurrency,
42
+ y as isDate,
43
+ nr as isEmail,
44
+ w as isEmpty,
45
+ I as isEquals,
46
+ D as isFile,
47
+ E as isFunction,
48
+ dr as isIdCard,
49
+ b as isMap,
50
+ xr as isMobile,
51
+ j as isNull,
52
+ v as isNumber,
53
+ A as isObject,
54
+ ur as isPassport,
55
+ P as isPromise,
56
+ S as isRegExp,
57
+ C as isSet,
58
+ h as isString,
59
+ q as isUndefined,
60
+ cr as isUrl,
61
+ Z as json2params,
62
+ gr as maxLength,
63
+ yr as minLength,
64
+ _ as padQuery,
65
+ rr as padZero,
66
+ z as params2json,
67
+ R as pick,
68
+ tr as randomString,
69
+ Dr as regs,
70
+ Er as required,
71
+ er as thousands,
72
+ ar as uuid,
73
+ sr as validate,
74
+ mr as validateRequire,
75
+ br as validateType,
76
+ jr as validation
76
77
  };
@@ -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 default
5
+ t as isEmpty
6
6
  };
@@ -1,4 +1,4 @@
1
- function s(r, t) {
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 e = 0; e < r.length; e++)
10
- if (!s(r[e], t[e]))
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 n = Object.getOwnPropertyNames(r), o = Object.getOwnPropertyNames(t);
17
- if (n.length !== o.length)
16
+ const e = Object.getOwnPropertyNames(r), s = Object.getOwnPropertyNames(t);
17
+ if (e.length !== s.length)
18
18
  return !1;
19
- for (let e = 0; e < n.length; e++) {
20
- const f = n[e];
21
- if (!s(r[f], t[f]))
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
- s as default
35
+ o as depsAreSame,
36
+ i as isEquals
28
37
  };
@@ -0,0 +1,15 @@
1
+ import { isObject as r } from "../is/is.js";
2
+ function n(...o) {
3
+ return o.filter((s) => !!s).map((s) => {
4
+ if (r(s)) {
5
+ const t = [];
6
+ Object.keys(s).forEach((c) => {
7
+ s[c] && t.push(c);
8
+ }), s = t.join(" ");
9
+ }
10
+ return s;
11
+ }).join(" ");
12
+ }
13
+ export {
14
+ n as classnames
15
+ };
@@ -1,57 +1,55 @@
1
- import { isClient as l } from "./util.js";
2
- import "../calc/index.js";
3
- import "../_virtual/dayjs.min.js";
1
+ import { isBrowser as l } from "./util.js";
4
2
  import { isString as d } from "../is/is.js";
5
- import s from "../is/is-empty.js";
6
- function f(t, n = "&") {
7
- return s(t) ? {} : decodeURIComponent(t).replace(/^\?/, "").split(n).reduce((r, m) => {
8
- const [o, c] = m.split("=");
9
- if (o) {
10
- const u = c ?? "";
11
- r[o] && typeof r[o] == "string" ? r[o] = [r[o], u] : r[o] ? r[o].push(u) : r[o] = u;
3
+ import { isEmpty as o } from "../is/is-empty.js";
4
+ function f(n, r = "&") {
5
+ return o(n) ? {} : decodeURIComponent(n).replace(/^\?/, "").split(r).reduce((t, c) => {
6
+ const [s, m] = c.split("=");
7
+ if (s) {
8
+ const u = m ?? "";
9
+ t[s] && typeof t[s] == "string" ? t[s] = [t[s], u] : t[s] ? t[s].push(u) : t[s] = u;
12
10
  }
13
- return r;
11
+ return t;
14
12
  }, {});
15
13
  }
16
- function p(t, n = "&") {
17
- return s(t) ? "" : Object.keys(t).map((e) => {
18
- const i = t[e];
19
- return Array.isArray(i) ? i.map((r) => `${e}=${r}`).join(n) : `${e}=${i}`;
20
- }).join(n);
14
+ function p(n, r = "&") {
15
+ return o(n) ? "" : Object.keys(n).map((e) => {
16
+ const i = n[e];
17
+ return Array.isArray(i) ? i.map((t) => `${e}=${t}`).join(r) : `${e}=${i}`;
18
+ }).join(r);
21
19
  }
22
- function q(t, n) {
23
- const e = l ? window : { location: { search: "" } }, i = new RegExp("(^|&)" + t + "=([^&]*)(&|$)"), r = (n || e.location.search).substr(1).match(i);
24
- return r != null ? unescape(r[2]) : null;
20
+ function E(n, r) {
21
+ const e = l ? window : { location: { search: "" } }, i = new RegExp("(^|&)" + n + "=([^&]*)(&|$)"), t = (r || e.location.search).substr(1).match(i);
22
+ return t != null ? unescape(t[2]) : null;
25
23
  }
26
- function a(t) {
27
- return Object.keys(t).forEach((n) => {
28
- (s(t[n]) || t[n] === "undefined") && t[n] !== 0 && delete t[n];
29
- }), t;
24
+ function a(n) {
25
+ return Object.keys(n).forEach((r) => {
26
+ (o(n[r]) || n[r] === "undefined") && n[r] !== 0 && delete n[r];
27
+ }), n;
30
28
  }
31
- function h(t, n = []) {
32
- const e = d(t);
33
- if (s(t)) return e ? "" : {};
34
- const i = e ? f(t) : t;
35
- return n.forEach((r) => {
36
- delete i[r];
29
+ function h(n, r = []) {
30
+ const e = d(n);
31
+ if (o(n)) return e ? "" : {};
32
+ const i = e ? f(n) : n;
33
+ return r.forEach((t) => {
34
+ delete i[t];
37
35
  }), e ? p(i) : i;
38
36
  }
39
- function y(t, n) {
40
- if (s(t)) return "";
41
- t = decodeURIComponent(t);
42
- const [e, i] = t.split("?"), r = a(Object.assign({}, f(i), a(Object.assign({}, n || {}))));
43
- return `${e}?${p(r)}`;
37
+ function y(n, r) {
38
+ if (o(n)) return "";
39
+ n = decodeURIComponent(n);
40
+ const [e, i] = n.split("?"), t = a(Object.assign({}, f(i), a(Object.assign({}, r || {}))));
41
+ return `${e}?${p(t)}`;
44
42
  }
45
- function O(t, n = []) {
46
- if (s(t)) return "";
47
- const [e, i = ""] = t.split("?");
48
- return y(e, f(h(i, n)));
43
+ function P(n, r = []) {
44
+ if (o(n)) return "";
45
+ const [e, i = ""] = n.split("?");
46
+ return y(e, f(h(i, r)));
49
47
  }
50
48
  export {
51
49
  h as filterParams,
52
- O as filterQuery,
50
+ P as filterQuery,
53
51
  a as filtrationEmpty,
54
- q as getUrlParam,
52
+ E as getUrlParam,
55
53
  p as json2params,
56
54
  y as padQuery,
57
55
  f as params2json
@@ -1,14 +1,12 @@
1
- import "../calc/index.js";
2
- import "../_virtual/dayjs.min.js";
1
+ import { isEmpty as c } from "../is/is-empty.js";
3
2
  import { isNumber as f } from "../is/is.js";
4
- import c from "../is/is-empty.js";
5
- const x = typeof window > "u", A = typeof window < "u";
6
- function R(t, n, e) {
3
+ const S = !!(typeof window < "u" && window.document && window.document.createElement);
4
+ function O(t, n, e) {
7
5
  return c(t) || c(n) || Object.keys(t).forEach((i) => {
8
6
  n[i] !== void 0 && !(e != null && e.includes(i)) && (t[i] = n[i]);
9
7
  }), t;
10
8
  }
11
- function P() {
9
+ function x() {
12
10
  var e, i;
13
11
  const t = (i = (e = navigator == null ? void 0 : navigator.userAgent) == null ? void 0 : e.toLowerCase) == null ? void 0 : i.call(e), n = {
14
12
  ios: !!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/i),
@@ -22,7 +20,7 @@ function P() {
22
20
  isMobile: n.android || n.ios || n.iPad
23
21
  };
24
22
  }
25
- function y(t, n = 2) {
23
+ function A(t, n = 2) {
26
24
  return t.toString().padStart(n, "0");
27
25
  }
28
26
  function E(t, n = [3, 7], e = "*", i) {
@@ -32,7 +30,7 @@ function E(t, n = [3, 7], e = "*", i) {
32
30
  const [o, r] = n;
33
31
  return t.slice(0, o) + e.repeat(t.length - r) + t.slice(r);
34
32
  }
35
- const U = function(t, n = 2, e = !0, i = ",") {
33
+ const P = function(t, n = 2, e = !0, i = ",") {
36
34
  const o = Number(t);
37
35
  if (f(o)) {
38
36
  let r = "";
@@ -50,22 +48,21 @@ const U = function(t, n = 2, e = !0, i = ",") {
50
48
  }
51
49
  return t;
52
50
  };
53
- function C(t, n) {
54
- const i = (g) => g * (Math.PI / 180), o = i(t.latitude), r = i(t.longitude), s = i(n.latitude), a = i(n.longitude), l = s - o, m = a - r, d = Math.pow(Math.sin(l / 2), 2) + Math.cos(o) * Math.cos(s) * Math.pow(Math.sin(m / 2), 2), u = 6371 * (2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d))), p = u * 1e3;
51
+ function R(t, n) {
52
+ const i = (h) => h * (Math.PI / 180), o = i(t.latitude), r = i(t.longitude), s = i(n.latitude), a = i(n.longitude), l = s - o, m = a - r, d = Math.pow(Math.sin(l / 2), 2) + Math.cos(o) * Math.cos(s) * Math.pow(Math.sin(m / 2), 2), u = 6371 * (2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d))), g = u * 1e3;
55
53
  return {
56
54
  km: Number(u.toFixed(2)),
57
55
  // 保留两位小数
58
- m: Math.round(p)
56
+ m: Math.round(g)
59
57
  // 四舍五入到整数
60
58
  };
61
59
  }
62
60
  export {
63
- R as ObjectAssign,
64
- P as browser,
65
- C as calculateDistance,
61
+ O as ObjectAssign,
62
+ x as browser,
63
+ R as calculateDistance,
66
64
  E as encryptString,
67
- A as isClient,
68
- x as isSSR,
69
- y as padZero,
70
- U as thousands
65
+ S as isBrowser,
66
+ A as padZero,
67
+ P as thousands
71
68
  };
@@ -1,3 +1,3 @@
1
1
  export * from './is';
2
- export { default as isEmpty } from './is-empty';
3
- export { default as isEquals } from './is-equals';
2
+ export * from './is-empty';
3
+ export * from './is-equals';
@@ -10,5 +10,4 @@
10
10
  * const a = {};
11
11
  * isEmpty(a) => true;
12
12
  */
13
- declare function isEmpty(value: unknown): value is null;
14
- export default isEmpty;
13
+ export declare function isEmpty(value: unknown): value is null;
@@ -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
- export default isEquals;
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 {};
@@ -15,5 +15,4 @@
15
15
  *
16
16
  * @param {...any} args
17
17
  */
18
- declare function classnames(...args: any[]): string;
19
- export default classnames;
18
+ export declare function classnames(...args: any[]): string;
@@ -1,11 +1,7 @@
1
1
  /**
2
- * 当前是否是服务端环境
2
+ * 当前是否是浏览器环境
3
3
  */
4
- export declare const isSSR: boolean;
5
- /**
6
- * 当前是否是客户端环境
7
- */
8
- export declare const isClient: boolean;
4
+ export declare const isBrowser: boolean;
9
5
  /**
10
6
  * Copy object data
11
7
  * @param obj1 target
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@spacego/turbo-utils",
3
- "version": "0.0.1-alpha",
3
+ "version": "0.0.1-alpha.1",
4
4
  "description": "🚀 A universal tool library. It basically covers all the commonly used practical functions. ",
5
5
  "type": "module",
6
6
  "main": "lib/cjs/index.js",
7
7
  "module": "lib/es/index.js",
8
8
  "typings": "lib/types/index.d.ts",
9
+ "sideEffects": false,
9
10
  "exports": {
10
11
  ".": {
11
12
  "types": "./lib/types/index.d.ts",
@@ -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;
@@ -1,13 +0,0 @@
1
- import r from "./calc.js";
2
- import { Decimal as p } from "../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
3
- Number.prototype.toFixedNew = function(t) {
4
- let o = this;
5
- return o < 0 ? (o = o * -1, (Math.round(r.multiply(o, Math.pow(10, t))) / Math.pow(10, t) * -1).toFixed(t)) : (Math.round(r.multiply(o, Math.pow(10, t))) / Math.pow(10, t)).toFixed(t);
6
- };
7
- Number.prototype.countDecimals = function() {
8
- return Math.floor(this.valueOf()) === this.valueOf() ? 0 : this.toString().split(".")[1].length || 0;
9
- };
10
- export {
11
- p as Decimal,
12
- r as calc
13
- };