Comparing version 0.0.2 to 0.0.3
@@ -16,3 +16,3 @@ /** 精确加 */ | ||
*/ | ||
declare function classof(value: unknown): string; | ||
declare function classof(value: any): string; | ||
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
declare function deepClone<T = Record<string, unknown> | []>(source: T): T; | ||
declare function deepClone<T = Record<string, any> | []>(source: T): T; | ||
@@ -28,5 +28,5 @@ /** | ||
*/ | ||
declare function isPlainObject(value: unknown): value is Record<string, unknown>; | ||
declare function isPlainObject(value: any): value is Record<string, any>; | ||
/** 判断值是否为数组 */ | ||
declare function isArray(value: unknown): value is []; | ||
declare function isArray(value: any): value is []; | ||
@@ -40,3 +40,3 @@ /** | ||
*/ | ||
declare function mergeObjects(sourceObj: Record<string, unknown>, ...targetObjs: Record<string, unknown>[]): Record<string, unknown>; | ||
declare function mergeObjects(sourceObj: Record<string, any>, ...targetObjs: Record<string, any>[]): Record<string, any>; | ||
@@ -43,0 +43,0 @@ /** 字符比较 */ |
@@ -1,3 +0,3 @@ | ||
function b(t,n){t=t||0,n=n||0;let o=(t.toString().split(".")[1]||"").length,r=(n.toString().split(".")[1]||"").length,e=Math.pow(10,Math.max(o,r));return (Math.round(t*e)+Math.round(n*e))/e}function x(t,n){t=t||0,n=n||0;let o=0,r=t.toString(),e=n.toString();try{o+=r.split(".")[1].length;}catch{}try{o+=e.split(".")[1].length;}catch{}return Number(r.replace(".",""))*Number(e.replace(".",""))/Math.pow(10,o)}function S(t,n){t=t||0,n=n||0;let o,r;try{o=t.toString().split(".")[1].length;}catch{o=0;}try{r=n.toString().split(".")[1].length;}catch{r=0;}let e=Number(t.toString().replace(".","")),i=Number(n.toString().replace(".",""));return x(e/i,Math.pow(10,r-o))}function k(t,n){return b(t,-n)}function u(t){return t===null?"null":typeof t!="object"?typeof t:Object.prototype.toString.call(t).slice(8,-1).toLocaleLowerCase()}function c(t){return u(t)==="object"}function m(t){return u(t)==="array"}function f(t){if(!c(t)&&!m(t))return t;let n=m(t)?[]:{};return Object.keys(t).forEach(o=>{let r=t[o];c(r)||m(r)?n[o]=f(r):n[o]=t[o];}),n}function g(t,...n){return n.filter(r=>c(r)).forEach(r=>{for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)){let i=r[e];c(i)&&c(t[e])?g(t[e],f(i)):t[e]=i;}}),t}function B(t,n){t=t.toString(),n=n.toString();let o=/(\d+)|(\D+)/g,r=t.match(o),e=n.match(o);if(!r||!e)return t.localeCompare(n);let i=Math.min(r.length,e.length);for(let l=0;l<i;l++){let s=r[l],p=e[l];if(/\d+/.test(s)&&/\d+/.test(p)){let a=parseInt(s),h=parseInt(p);if(a!==h)return a-h;if(s.length!==p.length)return s.length-p.length}else if(s!==p)return s.localeCompare(p)}return r.length-e.length} | ||
function b(t,n){t=t||0,n=n||0;let o=(t.toString().split(".")[1]||"").length,r=(n.toString().split(".")[1]||"").length,e=Math.pow(10,Math.max(o,r));return (Math.round(t*e)+Math.round(n*e))/e}function x(t,n){t=t||0,n=n||0;let o=0,r=t.toString(),e=n.toString();try{o+=r.split(".")[1].length;}catch{}try{o+=e.split(".")[1].length;}catch{}return Number(r.replace(".",""))*Number(e.replace(".",""))/Math.pow(10,o)}function M(t,n){t=t||0,n=n||0;let o,r;try{o=t.toString().split(".")[1].length;}catch{o=0;}try{r=n.toString().split(".")[1].length;}catch{r=0;}let e=Number(t.toString().replace(".","")),i=Number(n.toString().replace(".",""));return x(e/i,Math.pow(10,r-o))}function C(t,n){return b(t,-n)}function f(t){return t===null?"null":typeof t!="object"?typeof t:Object.prototype.toString.call(t).slice(8,-1).toLocaleLowerCase()}function c(t){return f(t)==="object"}function m(t){return f(t)==="array"}function u(t){if(!c(t)&&!m(t))return t;let n=m(t)?[]:{};return Object.keys(t).forEach(o=>{let r=t[o];c(r)||m(r)?n[o]=u(r):n[o]=t[o];}),n}function g(t,...n){return n.filter(r=>c(r)).forEach(r=>{for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)){let i=r[e];c(i)&&c(t[e])?g(t[e],u(i)):t[e]=i;}}),t}function D(t,n){t=t.toString(),n=n.toString();let o=/(\d+)|(\D+)/g,r=t.match(o),e=n.match(o);if(!r||!e)return t.localeCompare(n);let i=Math.min(r.length,e.length);for(let l=0;l<i;l++){let s=r[l],p=e[l];if(/\d+/.test(s)&&/\d+/.test(p)){let a=parseInt(s),h=parseInt(p);if(a!==h)return a-h;if(s.length!==p.length)return s.length-p.length}else if(s!==p)return s.localeCompare(p)}return r.length-e.length} | ||
export { b as accAdd, S as accDiv, k as accMinus, x as accMul, u as classof, f as deepClone, m as isArray, c as isPlainObject, g as mergeObjects, B as strComparator }; | ||
export { b as accAdd, M as accDiv, C as accMinus, x as accMul, f as classof, u as deepClone, m as isArray, c as isPlainObject, g as mergeObjects, D as strComparator }; |
{ | ||
"name": "anyiutils", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "any i utils", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7426