Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

anyiutils

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anyiutils - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

3

dist/index.d.ts

@@ -32,4 +32,5 @@ /** 精确加 */

* 是否需要重试
* @param count 当前重试次数
*/
needRetry?: () => boolean;
needRetry?: (count: number) => boolean;
/**

@@ -36,0 +37,0 @@ * 每次执行 fn 后的回调函数

@@ -1,3 +0,3 @@

function b(t,r){t=t||0,r=r||0;let n=(t.toString().split(".")[1]||"").length,e=(r.toString().split(".")[1]||"").length,o=Math.pow(10,Math.max(n,e));return (Math.round(t*o)+Math.round(r*o))/o}function x(t,r){t=t||0,r=r||0;let n=0,e=t.toString(),o=r.toString();try{n+=e.split(".")[1].length;}catch{}try{n+=o.split(".")[1].length;}catch{}return Number(e.replace(".",""))*Number(o.replace(".",""))/Math.pow(10,n)}function R(t,r){t=t||0,r=r||0;let n,e;try{n=t.toString().split(".")[1].length;}catch{n=0;}try{e=r.toString().split(".")[1].length;}catch{e=0;}let o=Number(t.toString().replace(".","")),i=Number(r.toString().replace(".",""));return x(o/i,Math.pow(10,e-n))}function A(t,r){return b(t,-r)}function g(t){return new Promise(r=>{let n=setTimeout(()=>{r(),clearTimeout(n);},t);})}function N({fn:t,times:r=3,delay:n=1e3,onend:e=()=>{},needRetry:o=()=>!0,onfnend:i,onfnerror:l}){let c=0;return new Promise(s=>{let m=async()=>{let p,h=!1;try{p=await t();}catch(S){h=!0,typeof l=="function"&&l(S);}finally{c++,!h&&typeof i=="function"&&i(p);}let d=typeof o=="function"?o():!0;c<r&&d?(await g(typeof n=="function"?n(c):n),m()):(typeof e=="function"&&e(),s());};m();})}function u(t){return t===null?"null":typeof t!="object"?typeof t:Object.prototype.toString.call(t).slice(8,-1).toLocaleLowerCase()}function f(t){return u(t)==="object"}function a(t){return u(t)==="array"}function y(t){if(!f(t)&&!a(t))return t;let r=a(t)?[]:{};return Object.keys(t).forEach(n=>{let e=t[n];f(e)||a(e)?r[n]=y(e):r[n]=t[n];}),r}function M(t,...r){return r.filter(e=>f(e)).forEach(e=>{for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o)){let i=e[o];f(i)&&f(t[o])?M(t[o],y(i)):t[o]=i;}}),t}function H(t,r){t=t.toString(),r=r.toString();let n=/(\d+)|(\D+)/g,e=t.match(n),o=r.match(n);if(!e||!o)return t.localeCompare(r);let i=Math.min(e.length,o.length);for(let l=0;l<i;l++){let c=e[l],s=o[l];if(/\d+/.test(c)&&/\d+/.test(s)){let m=parseInt(c),p=parseInt(s);if(m!==p)return m-p;if(c.length!==s.length)return c.length-s.length}else if(c!==s)return c.localeCompare(s)}return e.length-o.length}
function b(t,r){t=t||0,r=r||0;let n=(t.toString().split(".")[1]||"").length,e=(r.toString().split(".")[1]||"").length,o=Math.pow(10,Math.max(n,e));return (Math.round(t*o)+Math.round(r*o))/o}function x(t,r){t=t||0,r=r||0;let n=0,e=t.toString(),o=r.toString();try{n+=e.split(".")[1].length;}catch{}try{n+=o.split(".")[1].length;}catch{}return Number(e.replace(".",""))*Number(o.replace(".",""))/Math.pow(10,n)}function P(t,r){t=t||0,r=r||0;let n,e;try{n=t.toString().split(".")[1].length;}catch{n=0;}try{e=r.toString().split(".")[1].length;}catch{e=0;}let o=Number(t.toString().replace(".","")),i=Number(r.toString().replace(".",""));return x(o/i,Math.pow(10,e-n))}function A(t,r){return b(t,-r)}function g(t){return new Promise(r=>{let n=setTimeout(()=>{r(),clearTimeout(n);},t);})}function N({fn:t,times:r=3,delay:n=1e3,onend:e,needRetry:o,onfnend:i,onfnerror:l}){let c=0;return new Promise(s=>{let f=async()=>{let p,h=!1;try{p=await t();}catch(d){h=!0,typeof l=="function"&&l(d);}finally{c++,!h&&typeof i=="function"&&i(p);}(typeof o=="function"?o(c):c<r)?(await g(typeof n=="function"?n(c):n),f()):(typeof e=="function"&&e(),s());};f();})}function u(t){return t===null?"null":typeof t!="object"?typeof t:Object.prototype.toString.call(t).slice(8,-1).toLocaleLowerCase()}function m(t){return u(t)==="object"}function a(t){return u(t)==="array"}function y(t){if(!m(t)&&!a(t))return t;let r=a(t)?[]:{};return Object.keys(t).forEach(n=>{let e=t[n];m(e)||a(e)?r[n]=y(e):r[n]=t[n];}),r}function S(t,...r){return r.filter(e=>m(e)).forEach(e=>{for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o)){let i=e[o];m(i)&&m(t[o])?S(t[o],y(i)):t[o]=i;}}),t}function H(t,r){t=t.toString(),r=r.toString();let n=/(\d+)|(\D+)/g,e=t.match(n),o=r.match(n);if(!e||!o)return t.localeCompare(r);let i=Math.min(e.length,o.length);for(let l=0;l<i;l++){let c=e[l],s=o[l];if(/\d+/.test(c)&&/\d+/.test(s)){let f=parseInt(c),p=parseInt(s);if(f!==p)return f-p;if(c.length!==s.length)return c.length-s.length}else if(c!==s)return c.localeCompare(s)}return e.length-o.length}
export { b as accAdd, R as accDiv, A as accMinus, x as accMul, N as callRetry, u as classof, y as deepClone, a as isArray, f as isPlainObject, M as mergeObjects, g as sleep, H as strComparator };
export { b as accAdd, P as accDiv, A as accMinus, x as accMul, N as callRetry, u as classof, y as deepClone, a as isArray, m as isPlainObject, S as mergeObjects, g as sleep, H as strComparator };
{
"name": "anyiutils",
"version": "0.0.4",
"version": "0.0.5",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc