New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@i.un/libs

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@i.un/libs - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

2

dist/index.modern.js

@@ -1,2 +0,2 @@

function t(t){return"function"==typeof(null==t?void 0:t.clone)}function e(t){const e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function n(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function r(t){return e(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})})}function o(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(t=>o(t));const n={};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=o(e[t]));return n}function i(t,e){let n=null;return function(...r){const o=this;null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(o,r),n=null},e)}}function c(t,e){let n=0;return function(...r){const o=Date.now();o-n>=e&&(t.apply(this,r),n=o)}}function s(t,e=0){return new Promise(n=>{0===e?n(t()):setTimeout(()=>{n(t())},e)})}function u(t){return new Proxy({},{get:(e,n)=>e.hasOwnProperty(n)?e[n]:t})}const l=Symbol("cacheDefaultValue"),a=u(l),f=u(!1);function d(t){return a[t]}function p(t){return a[t]!==l}const y={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function m(t,e=y){return function(...n){const i=r(n)+t.name+(e.identifier||"");if(p(i))return Promise.resolve(o(d(i)));if(f[i]){const t=Object.assign({},y,e);return new Promise(e=>{const n=Date.now(),r=setInterval(()=>{p(i)?(clearInterval(r),e(o(d(i)))):Date.now()-n>t.timeout&&(f[i]=!1,clearInterval(r),e(o(t.timeoutResult)))},100)})}return f[i]=!0,t(...n).then(t=>(a[i]=t,o(a[i]))).catch(t=>{throw t}).finally(()=>{f[i]=!1})}}function h(t,e=0){const n=function n(...r){if(n.isExecuting)return void console.log(`Function(${t.name}) is executing.`);n.isExecuting=!0;const o=performance.now();let i;function c(){const t=performance.now()-o;e&&e>t?setTimeout(()=>{n.isExecuting=!1},e-t):n.isExecuting=!1}try{i=t.apply(this,r),i instanceof Promise?i.finally(()=>{c()}):c()}catch(t){throw c(),t}return i};return n.isExecuting=!1,n}function g(t,e,n,r=!1){if(e in t.style)t.style[e]=n;else{const o=r?"important":"";t.style.setProperty(e,String(n),o)}}function w({tag:t="div",children:e=[],props:n={},attrs:r={},styles:o={}}={}){const i=document.createElement(t);Object.assign(i,n);for(const[t,e]of Object.entries(r))!1!==e&&i.setAttribute(t,e);for(const[t,e]of Object.entries(o))g(i,t,e);const c=Array.isArray(e)?e:[e];for(const t of c)t&&("object"==typeof t?t instanceof Element?i.appendChild(t):i.appendChild(w(t)):i.appendChild(document.createTextNode(t)));return i}function b(t){const e=document.createElementNS("http://www.w3.org/2000/svg",t.type);if(t.props)for(const[n,r]of Object.entries(t.props))e.setAttribute(n,r);if("string"==typeof t.children){const n=document.createTextNode(t.children);e.appendChild(n)}else Array.isArray(t.children)&&t.children.forEach(t=>{const n=b(t);e.appendChild(n)});return e}function E(t){const e=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!(e instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return e}function x(t){return"string"==typeof t?E(t):b(t)}async function T(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`网络请求失败: ${e.status} ${e.statusText}`);return E(await e.text())}catch(t){const e=t instanceof Error?t.message:"未知错误";throw new Error(`无法创建 SVG 元素: ${e}`)}}function O(t){t&&setTimeout(()=>{t.scrollTop=t.scrollHeight},0)}function S(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",()=>{!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&O(t))}export{m as cacheWrapper,o as cloneDeep,u as createDefaultObject,w as createElement,x as createSvg,E as createSvgFromString,T as createSvgFromUrl,b as createSvgFromVNode,i as debounce,s as delayExecution,r as generateStableUniqueKey,n as getGlobal,t as isCloneable,e as isPrimitive,O as scrollToBottom,S as scrollToBottomIfNeeded,h as singleExecutionWrapper,c as throttle};
function t(t){return"function"==typeof(null==t?void 0:t.clone)}function e(t){const e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function n(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function r(t){return e(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})})}function o(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(t=>o(t));const n={};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=o(e[t]));return n}function i(t,e){let n=null;return function(...r){const o=this;null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(o,r),n=null},e)}}function c(t,e){let n=0;return function(...r){const o=Date.now();o-n>=e&&(t.apply(this,r),n=o)}}function s(t,e=0){return new Promise(n=>{0===e?n(t()):setTimeout(()=>{n(t())},e)})}function u(t){return new Proxy({},{get:(e,n)=>e.hasOwnProperty(n)?e[n]:t})}const l=Symbol("cacheDefaultValue"),a=u(l),f=u(!1);function d(t){return a[t]}function p(t){return a[t]!==l}const y={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function m(t,e=y){return function(...n){const i=r(n)+t.name+(e.identifier||"");if(console.log(i),p(i))return Promise.resolve(o(d(i)));if(f[i]){const t=Object.assign({},y,e);return new Promise(e=>{const n=Date.now(),r=setInterval(()=>{p(i)?(clearInterval(r),e(o(d(i)))):Date.now()-n>t.timeout&&(f[i]=!1,clearInterval(r),e(o(t.timeoutResult)))},100)})}return f[i]=!0,t(...n).then(t=>(a[i]=t,o(a[i]))).catch(t=>{throw t}).finally(()=>{f[i]=!1})}}function g(t,e=0){const n=function n(...r){if(n.isExecuting)return void console.log(`Function(${t.name}) is executing.`);n.isExecuting=!0;const o=performance.now();let i;function c(){const t=performance.now()-o;e&&e>t?setTimeout(()=>{n.isExecuting=!1},e-t):n.isExecuting=!1}try{i=t.apply(this,r),i instanceof Promise?i.finally(()=>{c()}):c()}catch(t){throw c(),t}return i};return n.isExecuting=!1,n}function h(t,e,n,r=!1){if(e in t.style)t.style[e]=n;else{const o=r?"important":"";t.style.setProperty(e,String(n),o)}}function w({tag:t="div",children:e=[],props:n={},attrs:r={},styles:o={}}={}){const i=document.createElement(t);Object.assign(i,n);for(const[t,e]of Object.entries(r))!1!==e&&i.setAttribute(t,e);for(const[t,e]of Object.entries(o))h(i,t,e);const c=Array.isArray(e)?e:[e];for(const t of c)t&&("object"==typeof t?t instanceof Element?i.appendChild(t):i.appendChild(w(t)):i.appendChild(document.createTextNode(t)));return i}function b(t){const e=document.createElementNS("http://www.w3.org/2000/svg",t.type);if(t.props)for(const[n,r]of Object.entries(t.props))e.setAttribute(n,r);if("string"==typeof t.children){const n=document.createTextNode(t.children);e.appendChild(n)}else Array.isArray(t.children)&&t.children.forEach(t=>{const n=b(t);e.appendChild(n)});return e}function E(t){const e=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!(e instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return e}function x(t){return"string"==typeof t?E(t):b(t)}async function T(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`网络请求失败: ${e.status} ${e.statusText}`);return E(await e.text())}catch(t){const e=t instanceof Error?t.message:"未知错误";throw new Error(`无法创建 SVG 元素: ${e}`)}}function O(t){t&&setTimeout(()=>{t.scrollTop=t.scrollHeight},0)}function S(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",()=>{!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&O(t))}export{m as cacheWrapper,o as cloneDeep,u as createDefaultObject,w as createElement,x as createSvg,E as createSvgFromString,T as createSvgFromUrl,b as createSvgFromVNode,i as debounce,s as delayExecution,r as generateStableUniqueKey,n as getGlobal,t as isCloneable,e as isPrimitive,O as scrollToBottom,S as scrollToBottomIfNeeded,g as singleExecutionWrapper,c as throttle};
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

function t(t){return"function"==typeof(null==t?void 0:t.clone)}function e(t){var e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function n(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function r(t){return e(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})})}function o(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(function(t){return o(t)});var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=o(e[r]));return n}function i(t,e){var n=null;return function(){var r=arguments,o=this;null!==n&&clearTimeout(n),n=setTimeout(function(){t.apply(o,[].slice.call(r)),n=null},e)}}function u(t,e){var n=0;return function(){var r=Date.now();r-n>=e&&(t.apply(this,[].slice.call(arguments)),n=r)}}function a(t,e){return void 0===e&&(e=0),new Promise(function(n){0===e?n(t()):setTimeout(function(){n(t())},e)})}function c(t){return new Proxy({},{get:function(e,n){return e.hasOwnProperty(n)?e[n]:t}})}var l=Symbol("cacheDefaultValue"),s=c(l),f=c(!1);function d(t){return s[t]}function v(t){return s[t]!==l}var p={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function y(t,e){return void 0===e&&(e=p),function(){var n=[].slice.call(arguments),i=r(n)+t.name+(e.identifier||"");if(v(i))return Promise.resolve(o(d(i)));if(f[i]){var u=Object.assign({},p,e);return new Promise(function(t){var e=Date.now(),n=setInterval(function(){v(i)?(clearInterval(n),t(o(d(i)))):Date.now()-e>u.timeout&&(f[i]=!1,clearInterval(n),t(o(u.timeoutResult)))},100)})}return f[i]=!0,t.apply(void 0,n).then(function(t){return s[i]=t,o(s[i])}).catch(function(t){throw t}).finally(function(){f[i]=!1})}}function m(t,e){void 0===e&&(e=0);var n=function(){if(!n.isExecuting){n.isExecuting=!0;var r,o=performance.now();try{(r=t.apply(this,[].slice.call(arguments)))instanceof Promise?r.finally(function(){i()}):i()}catch(t){throw i(),t}return r}function i(){var t=performance.now()-o;e&&e>t?setTimeout(function(){n.isExecuting=!1},e-t):n.isExecuting=!1}console.log("Function("+t.name+") is executing.")};return n.isExecuting=!1,n}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function g(t,e,n,r){if(void 0===r&&(r=!1),e in t.style)t.style[e]=n;else{var o=r?"important":"";t.style.setProperty(e,String(n),o)}}var w=function(t){try{return Promise.resolve(function(e,n){try{var r=Promise.resolve(fetch(t)).then(function(t){if(!t.ok)throw new Error("网络请求失败: "+t.status+" "+t.statusText);return Promise.resolve(t.text()).then(A)})}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}(0,function(t){var e=t instanceof Error?t.message:"未知错误";throw new Error("无法创建 SVG 元素: "+e)}))}catch(t){return Promise.reject(t)}};function b(t){var e=void 0===t?{}:t,n=e.tag,r=e.children,o=void 0===r?[]:r,i=e.props,u=void 0===i?{}:i,a=e.attrs,c=void 0===a?{}:a,l=e.styles,s=void 0===l?{}:l,f=document.createElement(void 0===n?"div":n);Object.assign(f,u);for(var d=0,v=Object.entries(c);d<v.length;d++){var p=v[d],y=p[1];!1!==y&&f.setAttribute(p[0],y)}for(var m=0,w=Object.entries(s);m<w.length;m++){var E=w[m];g(f,E[0],E[1])}for(var A,S=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return h(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(t,e):void 0}}(t))){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Array.isArray(o)?o:[o]);!(A=S()).done;){var x=A.value;x&&("object"==typeof x?x instanceof Element?f.appendChild(x):f.appendChild(b(x)):f.appendChild(document.createTextNode(x)))}return f}function E(t){var e=document.createElementNS("http://www.w3.org/2000/svg",t.type);if(t.props)for(var n=0,r=Object.entries(t.props);n<r.length;n++){var o=r[n];e.setAttribute(o[0],o[1])}if("string"==typeof t.children){var i=document.createTextNode(t.children);e.appendChild(i)}else Array.isArray(t.children)&&t.children.forEach(function(t){var n=E(t);e.appendChild(n)});return e}function A(t){var e=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!(e instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return e}function S(t){return"string"==typeof t?A(t):E(t)}function x(t){t&&setTimeout(function(){t.scrollTop=t.scrollHeight},0)}function j(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",function(){!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&x(t))}export{y as cacheWrapper,o as cloneDeep,c as createDefaultObject,b as createElement,S as createSvg,A as createSvgFromString,w as createSvgFromUrl,E as createSvgFromVNode,i as debounce,a as delayExecution,r as generateStableUniqueKey,n as getGlobal,t as isCloneable,e as isPrimitive,x as scrollToBottom,j as scrollToBottomIfNeeded,m as singleExecutionWrapper,u as throttle};
function e(e){return"function"==typeof(null==e?void 0:e.clone)}function t(e){var t=typeof e;return null===e||"string"===t||"number"===t||"boolean"===t||"undefined"===t}function n(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function r(e){return t(e)?String(e):JSON.stringify(e,function(e,t){return"object"!=typeof t||null===t||Array.isArray(t)?t:Object.keys(t).sort().reduce(function(e,n){return e[n]=t[n],e},{})})}function o(t){if(null===t||"object"!=typeof t)return t;if(e(t))return t.clone();if(Array.isArray(t))return t.map(function(e){return o(e)});var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=o(t[r]));return n}function i(e,t){var n=null;return function(){var r=arguments,o=this;null!==n&&clearTimeout(n),n=setTimeout(function(){e.apply(o,[].slice.call(r)),n=null},t)}}function u(e,t){var n=0;return function(){var r=Date.now();r-n>=t&&(e.apply(this,[].slice.call(arguments)),n=r)}}function a(e,t){return void 0===t&&(t=0),new Promise(function(n){0===t?n(e()):setTimeout(function(){n(e())},t)})}function c(e){return new Proxy({},{get:function(t,n){return t.hasOwnProperty(n)?t[n]:e}})}var l=Symbol("cacheDefaultValue"),s=c(l),f=c(!1);function d(e){return s[e]}function v(e){return s[e]!==l}var p={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function y(e,t){return void 0===t&&(t=p),function(){var n=[].slice.call(arguments),i=r(n)+e.name+(t.identifier||"");if(console.log(i),v(i))return Promise.resolve(o(d(i)));if(f[i]){var u=Object.assign({},p,t);return new Promise(function(e){var t=Date.now(),n=setInterval(function(){v(i)?(clearInterval(n),e(o(d(i)))):Date.now()-t>u.timeout&&(f[i]=!1,clearInterval(n),e(o(u.timeoutResult)))},100)})}return f[i]=!0,e.apply(void 0,n).then(function(e){return s[i]=e,o(s[i])}).catch(function(e){throw e}).finally(function(){f[i]=!1})}}function m(e,t){void 0===t&&(t=0);var n=function(){if(!n.isExecuting){n.isExecuting=!0;var r,o=performance.now();try{(r=e.apply(this,[].slice.call(arguments)))instanceof Promise?r.finally(function(){i()}):i()}catch(e){throw i(),e}return r}function i(){var e=performance.now()-o;t&&t>e?setTimeout(function(){n.isExecuting=!1},t-e):n.isExecuting=!1}console.log("Function("+e.name+") is executing.")};return n.isExecuting=!1,n}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t,n,r){if(void 0===r&&(r=!1),t in e.style)e.style[t]=n;else{var o=r?"important":"";e.style.setProperty(t,String(n),o)}}var w=function(e){try{return Promise.resolve(function(t,n){try{var r=Promise.resolve(fetch(e)).then(function(e){if(!e.ok)throw new Error("网络请求失败: "+e.status+" "+e.statusText);return Promise.resolve(e.text()).then(A)})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){var t=e instanceof Error?e.message:"未知错误";throw new Error("无法创建 SVG 元素: "+t)}))}catch(e){return Promise.reject(e)}};function b(e){var t=void 0===e?{}:e,n=t.tag,r=t.children,o=void 0===r?[]:r,i=t.props,u=void 0===i?{}:i,a=t.attrs,c=void 0===a?{}:a,l=t.styles,s=void 0===l?{}:l,f=document.createElement(void 0===n?"div":n);Object.assign(f,u);for(var d=0,v=Object.entries(c);d<v.length;d++){var p=v[d],y=p[1];!1!==y&&f.setAttribute(p[0],y)}for(var m=0,w=Object.entries(s);m<w.length;m++){var E=w[m];g(f,E[0],E[1])}for(var A,S=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Array.isArray(o)?o:[o]);!(A=S()).done;){var x=A.value;x&&("object"==typeof x?x instanceof Element?f.appendChild(x):f.appendChild(b(x)):f.appendChild(document.createTextNode(x)))}return f}function E(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e.type);if(e.props)for(var n=0,r=Object.entries(e.props);n<r.length;n++){var o=r[n];t.setAttribute(o[0],o[1])}if("string"==typeof e.children){var i=document.createTextNode(e.children);t.appendChild(i)}else Array.isArray(e.children)&&e.children.forEach(function(e){var n=E(e);t.appendChild(n)});return t}function A(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function S(e){return"string"==typeof e?A(e):E(e)}function x(e){e&&setTimeout(function(){e.scrollTop=e.scrollHeight},0)}function j(e){e&&("true"!==e.dataset.isListeningForUserScroll&&(function(e){e&&e.addEventListener("scroll",function(){!function(e,t){e.dataset.userInteracted=t?"true":"false"}(e,e.scrollTop+e.clientHeight<e.scrollHeight-5)})}(e),e.dataset.isListeningForUserScroll="true"),"true"!==e.dataset.userInteracted&&x(e))}export{y as cacheWrapper,o as cloneDeep,c as createDefaultObject,b as createElement,S as createSvg,A as createSvgFromString,w as createSvgFromUrl,E as createSvgFromVNode,i as debounce,a as delayExecution,r as generateStableUniqueKey,n as getGlobal,e as isCloneable,t as isPrimitive,x as scrollToBottom,j as scrollToBottomIfNeeded,m as singleExecutionWrapper,u as throttle};
//# sourceMappingURL=index.module.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).iunLibs={})}(this,function(e){function t(e){return"function"==typeof(null==e?void 0:e.clone)}function n(e){var t=typeof e;return null===e||"string"===t||"number"===t||"boolean"===t||"undefined"===t}function r(e){return n(e)?String(e):JSON.stringify(e,function(e,t){return"object"!=typeof t||null===t||Array.isArray(t)?t:Object.keys(t).sort().reduce(function(e,n){return e[n]=t[n],e},{})})}function o(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(function(e){return o(e)});var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=o(e[r]));return n}function i(e){return new Proxy({},{get:function(t,n){return t.hasOwnProperty(n)?t[n]:e}})}var a=Symbol("cacheDefaultValue"),u=i(a),c=i(!1);function l(e){return u[e]}function s(e){return u[e]!==a}var f={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r){if(void 0===r&&(r=!1),t in e.style)e.style[t]=n;else{var o=r?"important":"";e.style.setProperty(t,String(n),o)}}function p(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e.type);if(e.props)for(var n=0,r=Object.entries(e.props);n<r.length;n++){var o=r[n];t.setAttribute(o[0],o[1])}if("string"==typeof e.children){var i=document.createTextNode(e.children);t.appendChild(i)}else Array.isArray(e.children)&&e.children.forEach(function(e){var n=p(e);t.appendChild(n)});return t}function m(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function y(e){e&&setTimeout(function(){e.scrollTop=e.scrollHeight},0)}e.cacheWrapper=function(e,t){return void 0===t&&(t=f),function(){var n=[].slice.call(arguments),i=r(n)+e.name+(t.identifier||"");if(s(i))return Promise.resolve(o(l(i)));if(c[i]){var a=Object.assign({},f,t);return new Promise(function(e){var t=Date.now(),n=setInterval(function(){s(i)?(clearInterval(n),e(o(l(i)))):Date.now()-t>a.timeout&&(c[i]=!1,clearInterval(n),e(o(a.timeoutResult)))},100)})}return c[i]=!0,e.apply(void 0,n).then(function(e){return u[i]=e,o(u[i])}).catch(function(e){throw e}).finally(function(){c[i]=!1})}},e.cloneDeep=o,e.createDefaultObject=i,e.createElement=function e(t){var n=void 0===t?{}:t,r=n.tag,o=n.children,i=void 0===o?[]:o,a=n.props,u=void 0===a?{}:a,c=n.attrs,l=void 0===c?{}:c,s=n.styles,f=void 0===s?{}:s,p=document.createElement(void 0===r?"div":r);Object.assign(p,u);for(var m=0,y=Object.entries(l);m<y.length;m++){var h=y[m],g=h[1];!1!==g&&p.setAttribute(h[0],g)}for(var b=0,w=Object.entries(f);b<w.length;b++){var S=w[b];v(p,S[0],S[1])}for(var E,x=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Array.isArray(i)?i:[i]);!(E=x()).done;){var T=E.value;T&&("object"==typeof T?T instanceof Element?p.appendChild(T):p.appendChild(e(T)):p.appendChild(document.createTextNode(T)))}return p},e.createSvg=function(e){return"string"==typeof e?m(e):p(e)},e.createSvgFromString=m,e.createSvgFromUrl=function(e){try{return Promise.resolve(function(t,n){try{var r=Promise.resolve(fetch(e)).then(function(e){if(!e.ok)throw new Error("网络请求失败: "+e.status+" "+e.statusText);return Promise.resolve(e.text()).then(m)})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){var t=e instanceof Error?e.message:"未知错误";throw new Error("无法创建 SVG 元素: "+t)}))}catch(e){return Promise.reject(e)}},e.createSvgFromVNode=p,e.debounce=function(e,t){var n=null;return function(){var r=arguments,o=this;null!==n&&clearTimeout(n),n=setTimeout(function(){e.apply(o,[].slice.call(r)),n=null},t)}},e.delayExecution=function(e,t){return void 0===t&&(t=0),new Promise(function(n){0===t?n(e()):setTimeout(function(){n(e())},t)})},e.generateStableUniqueKey=r,e.getGlobal=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this},e.isCloneable=t,e.isPrimitive=n,e.scrollToBottom=y,e.scrollToBottomIfNeeded=function(e){e&&("true"!==e.dataset.isListeningForUserScroll&&(function(e){e&&e.addEventListener("scroll",function(){!function(e,t){e.dataset.userInteracted=t?"true":"false"}(e,e.scrollTop+e.clientHeight<e.scrollHeight-5)})}(e),e.dataset.isListeningForUserScroll="true"),"true"!==e.dataset.userInteracted&&y(e))},e.singleExecutionWrapper=function(e,t){void 0===t&&(t=0);var n=function(){if(!n.isExecuting){n.isExecuting=!0;var r,o=performance.now();try{(r=e.apply(this,[].slice.call(arguments)))instanceof Promise?r.finally(function(){i()}):i()}catch(e){throw i(),e}return r}function i(){var e=performance.now()-o;t&&t>e?setTimeout(function(){n.isExecuting=!1},t-e):n.isExecuting=!1}console.log("Function("+e.name+") is executing.")};return n.isExecuting=!1,n},e.throttle=function(e,t){var n=0;return function(){var r=Date.now();r-n>=t&&(e.apply(this,[].slice.call(arguments)),n=r)}}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).iunLibs={})}(this,function(e){function t(e){return"function"==typeof(null==e?void 0:e.clone)}function n(e){var t=typeof e;return null===e||"string"===t||"number"===t||"boolean"===t||"undefined"===t}function r(e){return n(e)?String(e):JSON.stringify(e,function(e,t){return"object"!=typeof t||null===t||Array.isArray(t)?t:Object.keys(t).sort().reduce(function(e,n){return e[n]=t[n],e},{})})}function o(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(function(e){return o(e)});var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=o(e[r]));return n}function i(e){return new Proxy({},{get:function(t,n){return t.hasOwnProperty(n)?t[n]:e}})}var a=Symbol("cacheDefaultValue"),u=i(a),c=i(!1);function l(e){return u[e]}function s(e){return u[e]!==a}var f={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r){if(void 0===r&&(r=!1),t in e.style)e.style[t]=n;else{var o=r?"important":"";e.style.setProperty(t,String(n),o)}}function p(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e.type);if(e.props)for(var n=0,r=Object.entries(e.props);n<r.length;n++){var o=r[n];t.setAttribute(o[0],o[1])}if("string"==typeof e.children){var i=document.createTextNode(e.children);t.appendChild(i)}else Array.isArray(e.children)&&e.children.forEach(function(e){var n=p(e);t.appendChild(n)});return t}function m(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function y(e){e&&setTimeout(function(){e.scrollTop=e.scrollHeight},0)}e.cacheWrapper=function(e,t){return void 0===t&&(t=f),function(){var n=[].slice.call(arguments),i=r(n)+e.name+(t.identifier||"");if(console.log(i),s(i))return Promise.resolve(o(l(i)));if(c[i]){var a=Object.assign({},f,t);return new Promise(function(e){var t=Date.now(),n=setInterval(function(){s(i)?(clearInterval(n),e(o(l(i)))):Date.now()-t>a.timeout&&(c[i]=!1,clearInterval(n),e(o(a.timeoutResult)))},100)})}return c[i]=!0,e.apply(void 0,n).then(function(e){return u[i]=e,o(u[i])}).catch(function(e){throw e}).finally(function(){c[i]=!1})}},e.cloneDeep=o,e.createDefaultObject=i,e.createElement=function e(t){var n=void 0===t?{}:t,r=n.tag,o=n.children,i=void 0===o?[]:o,a=n.props,u=void 0===a?{}:a,c=n.attrs,l=void 0===c?{}:c,s=n.styles,f=void 0===s?{}:s,p=document.createElement(void 0===r?"div":r);Object.assign(p,u);for(var m=0,y=Object.entries(l);m<y.length;m++){var g=y[m],h=g[1];!1!==h&&p.setAttribute(g[0],h)}for(var b=0,w=Object.entries(f);b<w.length;b++){var S=w[b];v(p,S[0],S[1])}for(var E,x=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Array.isArray(i)?i:[i]);!(E=x()).done;){var T=E.value;T&&("object"==typeof T?T instanceof Element?p.appendChild(T):p.appendChild(e(T)):p.appendChild(document.createTextNode(T)))}return p},e.createSvg=function(e){return"string"==typeof e?m(e):p(e)},e.createSvgFromString=m,e.createSvgFromUrl=function(e){try{return Promise.resolve(function(t,n){try{var r=Promise.resolve(fetch(e)).then(function(e){if(!e.ok)throw new Error("网络请求失败: "+e.status+" "+e.statusText);return Promise.resolve(e.text()).then(m)})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){var t=e instanceof Error?e.message:"未知错误";throw new Error("无法创建 SVG 元素: "+t)}))}catch(e){return Promise.reject(e)}},e.createSvgFromVNode=p,e.debounce=function(e,t){var n=null;return function(){var r=arguments,o=this;null!==n&&clearTimeout(n),n=setTimeout(function(){e.apply(o,[].slice.call(r)),n=null},t)}},e.delayExecution=function(e,t){return void 0===t&&(t=0),new Promise(function(n){0===t?n(e()):setTimeout(function(){n(e())},t)})},e.generateStableUniqueKey=r,e.getGlobal=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this},e.isCloneable=t,e.isPrimitive=n,e.scrollToBottom=y,e.scrollToBottomIfNeeded=function(e){e&&("true"!==e.dataset.isListeningForUserScroll&&(function(e){e&&e.addEventListener("scroll",function(){!function(e,t){e.dataset.userInteracted=t?"true":"false"}(e,e.scrollTop+e.clientHeight<e.scrollHeight-5)})}(e),e.dataset.isListeningForUserScroll="true"),"true"!==e.dataset.userInteracted&&y(e))},e.singleExecutionWrapper=function(e,t){void 0===t&&(t=0);var n=function(){if(!n.isExecuting){n.isExecuting=!0;var r,o=performance.now();try{(r=e.apply(this,[].slice.call(arguments)))instanceof Promise?r.finally(function(){i()}):i()}catch(e){throw i(),e}return r}function i(){var e=performance.now()-o;t&&t>e?setTimeout(function(){n.isExecuting=!1},t-e):n.isExecuting=!1}console.log("Function("+e.name+") is executing.")};return n.isExecuting=!1,n},e.throttle=function(e,t){var n=0;return function(){var r=Date.now();r-n>=t&&(e.apply(this,[].slice.call(arguments)),n=r)}}});
//# sourceMappingURL=index.umd.js.map
{
"name": "@i.un/libs",
"version": "0.0.22",
"version": "0.0.23",
"description": "一个实用的ts函数库",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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