Socket
Socket
Sign inDemoInstall

@daybrush/utils

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daybrush/utils - npm Package Compare versions

Comparing version 1.12.1 to 1.12.2

4

dist/utils.cjs.js

@@ -7,3 +7,3 @@ /*

repository: https://github.com/daybrush/utils
@version 1.12.1
@version 1.12.2
*/

@@ -1364,3 +1364,3 @@ 'use strict';

var cssObject = {};
var styles = window.getComputedStyle(element);
var styles = getWindow(element).getComputedStyle(element);
var length = properties.length;

@@ -1367,0 +1367,0 @@ for (var i = 0; i < length; ++i) {

@@ -7,3 +7,3 @@ /*

repository: https://github.com/daybrush/utils
@version 1.12.1
@version 1.12.2
*/

@@ -1360,3 +1360,3 @@ /**

var cssObject = {};
var styles = window.getComputedStyle(element);
var styles = getWindow(element).getComputedStyle(element);
var length = properties.length;

@@ -1363,0 +1363,0 @@ for (var i = 0; i < length; ++i) {

@@ -7,3 +7,3 @@ /*

repository: https://github.com/daybrush/utils
@version 1.12.1
@version 1.12.2
*/

@@ -1366,3 +1366,3 @@ (function (global, factory) {

var cssObject = {};
var styles = window.getComputedStyle(element);
var styles = getWindow(element).getComputedStyle(element);
var length = properties.length;

@@ -1369,0 +1369,0 @@ for (var i = 0; i < length; ++i) {

@@ -7,5 +7,5 @@ /*

repository: https://github.com/daybrush/utils
@version 1.12.1
@version 1.12.2
*/
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):n.utils=e()}(this,function(){"use strict";function n(n){if(l){var e=(l.body||l.documentElement).style,t=d.length;if(typeof e[n]!=o)return n;for(var r=0;r<t;++r){var i="-"+d[r]+"-"+n;if(typeof e[i]!=o)return i}}return""}var u="rgb",a="rgba",c="hsl",f="hsla",j=[u,a,c,f],e="function",t="object",r="string",i="number",o="undefined",s=typeof window!=o,l=typeof document!=o&&document,d=["webkit","ms","moz","o"],B=n("transform"),U=n("filter"),p=n("animation"),_=p.replace("animation","keyframes"),w=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],m=1e-7,v={cm:function(n){return 96*n/2.54},mm:function(n){return 96*n/254},in:function(n){return 96*n},pt:function(n){return 96*n/72},pc:function(n){return 96*n/6},"%":function(n,e){return n*e/100},vw:function(n,e){return n/100*(e=void 0===e?window.innerWidth:e)},vh:function(n,e){return n/100*(e=void 0===e?window.innerHeight:e)},vmax:function(n,e){return n/100*(e=void 0===e?Math.max(window.innerWidth,window.innerHeight):e)},vmin:function(n,e){return n/100*(e=void 0===e?Math.min(window.innerWidth,window.innerHeight):e)}};function h(n){return n&&typeof n==t}function g(n){return Array.isArray(n)}function y(n){return typeof n==r}function A(n){return typeof n==e}function S(n,e,t,r,i){if(b(n,e,t))return t;for(var o,u=n,a=e,c=r,f=i,s=t+1;s<c;++s){var l=function(n){var e,t,r=a[n].trim();return r!==u.close||b(u,a,n)?(e=n,-1===(e=(t=F(f,function(n){return n.open===r}))?S(t,a,n,c,f):e)?(o=n,"break"):void(o=n=e)):{value:n}}(s);if(s=o,"object"==typeof l)return l.value;if("break"===l)break}return-1}function b(n,e,t){return n.ignore?(e=e.slice(Math.max(t-3,0),t+3).join(""),new RegExp(n.ignore).exec(e)):null}function E(o,n){var n=y(n)?{separator:n}:n,e=n.separator,u=void 0===e?",":e,a=n.isSeparateFirst,c=n.isSeparateOnlyOpenClose,e=n.isSeparateOpenClose,f=void 0===e?c:e,e=n.openCloseCharacters,s=void 0===e?w:e,n=s.map(function(n){var e=n.open,n=n.close;return e===n?e:e+"|"+n}).join("|"),e=new RegExp("(\\s*"+u+"\\s*|"+n+"|\\s+)","g"),l=o.split(e).filter(function(n){return n&&"undefined"!==n}),d=l.length,p=[],m=[];function v(){return m.length&&(p.push(m.join("")),m=[])}for(var h,t=function(n){var e=l[n].trim(),t=n,r=F(s,function(n){return n.open===e}),i=F(s,function(n){return n.close===e});if(r){if(-1!==(t=S(r,l,n,d,s))&&f)return v()&&a||(p.push(l.slice(n,t+1).join("")),n=t,a)?(h=n,"break"):(h=n,"continue")}else{if(i&&!b(i,l,n))return(r=function(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),i=0,e=0;e<t;e++)for(var o=arguments[e],u=0,a=o.length;u<a;u++,i++)r[i]=o[u];return r}(s)).splice(s.indexOf(i),1),{value:E(o,{separator:u,isSeparateFirst:a,isSeparateOnlyOpenClose:c,isSeparateOpenClose:f,openCloseCharacters:r})};if(i=e,!((""!==(r=u)&&" "!=r||""!==i&&" "!=i)&&i!==r||c))return v(),a?(h=n,"break"):(h=n,"continue")}m.push(l.slice(n,(t=-1===t?d-1:t)+1).join("")),h=n=t},r=0;r<d;++r){var i=t(r),r=h;if("object"==typeof i)return i.value;if("break"===i)break}return m.length&&p.push(m.join("")),p}function x(n){return E(n,",")}function R(n){n=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(n);return!n||n.length<4?{}:{prefix:n[1],value:n[2],suffix:n[3]}}function C(n){var e,t,n=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(n);return n?(e=n[1],t=n[2],{prefix:e,unit:n[3],value:parseFloat(t)}):{prefix:"",unit:"",value:NaN}}function M(){return Date.now?Date.now():(new Date).getTime()}function O(n,e,t){void 0===t&&(t=-1);for(var r=n.length,i=0;i<r;++i)if(e(n[i],i,n))return i;return t}function z(n,e,t){void 0===t&&(t=-1);for(var r=n.length-1;0<=r;--r)if(e(n[r],r,n))return r;return t}function F(n,e,t){e=O(n,e);return-1<e?n[e]:t}var P=function(){var t=M(),n=s&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return n?n.bind(window):function(n){var e=M();return setTimeout(function(){n(e-t)},1e3/60)}}();function N(n){return Object.keys(n)}function q(n,e,t){return Math.max(e,Math.min(n,t))}function I(n,r,i,e){return void 0===e&&(e=n[0]/n[1]),[[L(r[0],m),L(r[0]/e,m)],[L(r[1]*e,m),L(r[1],m)]].filter(function(n){return n.every(function(n,e){var e=r[e],t=L(e,m);return i?n<=e||n<=t:e<=n||t<=n})})[0]||n}function H(n){for(var e=n.length,t=0,r=e-1;0<=r;--r)t+=n[r];return e?t/e:0}function T(n,e){var t=e[0]-n[0],e=e[1]-n[1],n=Math.atan2(e,t);return 0<=n?n:n+2*Math.PI}function G(n){return[0,1].map(function(e){return H(n.map(function(n){return n[e]}))})}function L(n,e){var t;return e?(t=1/e,Math.round(n/e)/t):n}function W(n){return n.replace("#","")}function D(n){var n=W(n),e=parseInt(n.substring(0,2),16),t=parseInt(n.substring(2,4),16),r=parseInt(n.substring(4,6),16),n=parseInt(n.substring(6,8),16)/255;return[e,t,r,n=isNaN(n)?1:n]}function Y(n){var e=n.charAt(1),t=n.charAt(2),r=n.charAt(3),n=n.charAt(4);return["#",e,e,t,t,r,r,n,n].join("")}function $(n){var e=n[0],t=n[1],r=n[2],t=(e<0&&(e+=360*Math.floor((Math.abs(e)+360)/360)),e%=360,(1-Math.abs(2*r-1))*t),i=t*(1-Math.abs(e/60%2-1)),r=r-t/2,e=e<60?[t,i,0]:e<120?[i,t,0]:e<180?[0,t,i]:e<240?[0,i,t]:e<300?[i,0,t]:e<360?[t,0,i]:[0,0,0];return[Math.round(255*(e[0]+r)),Math.round(255*(e[1]+r)),Math.round(255*(e[2]+r)),null!=(t=n[3])?t:1]}function k(n){return(null==n?void 0:n.ownerDocument)||l}return{RGB:u,RGBA:a,HSL:c,HSLA:f,COLOR_MODELS:j,FUNCTION:e,PROPERTY:"property",ARRAY:"array",OBJECT:t,STRING:r,NUMBER:i,UNDEFINED:o,IS_WINDOW:s,document:l,getCrossBrowserProperty:n,TRANSFORM:B,FILTER:U,ANIMATION:p,KEYFRAMES:_,OPEN_CLOSED_CHARACTERS:w,TINY_NUM:m,REVERSE_TINY_NUM:1e7,DEFAULT_UNIT_PRESETS:v,cutHex:W,hexToRGBA:D,toFullHex:Y,hslToRGBA:$,stringToRGBA:function(n){if("#"===n.charAt(0))return 4===n.length||5===n.length?D(Y(n)):D(n);if(-1!==n.indexOf("(")){var n=R(n),e=n.prefix,n=n.value;if(!e||!n)return;var t=x(n),r=[0,0,0,1],i=t.length;switch(e){case u:case a:for(var o=0;o<i;++o)r[o]=parseFloat(t[o]);return r;case c:case f:for(o=0;o<i;++o)-1!==t[o].indexOf("%")?r[o]=parseFloat(t[o])/100:r[o]=parseFloat(t[o]);return $(r)}}},dot:function(n,e,t,r){return(n*r+e*t)/(t+r)},isUndefined:function(n){return typeof n==o},isObject:h,isArray:g,isString:y,isNumber:function(n){return typeof n==i},isFunction:A,splitText:E,splitSpace:function(n){return E(n,"")},splitComma:x,splitBracket:R,splitUnit:C,camelize:function(n){return n.replace(/[\s-_]+([^\s-_])/g,function(n,e){return e.toUpperCase()})},decamelize:function(n,r){return void 0===r&&(r="-"),n.replace(/([a-z])([A-Z])/g,function(n,e,t){return""+e+r+t.toLowerCase()})},toArray:function(n){return[].slice.call(n)},now:M,findIndex:O,findLastIndex:z,findLast:function(n,e,t){return-1<(e=z(n,e))?n[e]:t},find:F,requestAnimationFrame:P,cancelAnimationFrame:function(){var n=s&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return n?n.bind(window):function(n){clearTimeout(n)}}(),getKeys:N,getValues:function(e){return N(e).map(function(n){return e[n]})},getEntries:function(e){return N(e).map(function(n){return[n,e[n]]})},sortOrders:function(n,t){void 0===t&&(t=[]),n.sort(function(n,e){n=t.indexOf(n),e=t.indexOf(e);return-1===e&&-1===n?0:-1===n?1:-1===e?-1:n-e})},convertUnitSize:function(n,e){var t=(n=C(n)).value,n=n.unit;if(h(e)){var r=e[n];if(r){if(A(r))return r(t);if(v[n])return v[n](t,r)}}else if("%"===n)return t*e/100;return v[n]?v[n](t):t},between:q,checkBoundSize:I,calculateBoundSize:function(n,t,r,e){var i,o,u,a,c;return e?(i=n[0],o=n[1],u=(a=I(n,t,!1,e=!0===e?i/o:e))[0],a=a[1],c=(e=I(n,r,!0,e))[0],e=e[1],i<u||o<a?(i=u,o=a):(c<i||e<o)&&(i=c,o=e),[i,o]):n.map(function(n,e){return q(n,t[e],r[e])})},sum:function(n){for(var e=0,t=n.length-1;0<=t;--t)e+=n[t];return e},average:H,getRad:T,getCenterPoint:G,getShapeDirection:function(n){var e=T(t=G(n),n[0]),t=T(t,n[1]);return e<t&&t-e<Math.PI||t<e&&t-e<-Math.PI?1:-1},getDist:function(n,e){return Math.sqrt(Math.pow((e?e[0]:0)-n[0],2)+Math.pow((e?e[1]:0)-n[1],2))},throttle:L,throttleArray:function(t,r){return t.forEach(function(n,e){t[e]=L(t[e],r)}),t},counter:function(n){for(var e=[],t=0;t<n;++t)e.push(t);return e},replaceOnce:function(n,e,t){var r=!1;return n.replace(e,function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return r?n[0]:(r=!0,y(t)?t:t.apply(void 0,n))})},flat:function(n){return n.reduce(function(n,e){return n.concat(e)},[])},deepFlat:function t(n){return n.reduce(function(n,e){return g(e)?n.push.apply(n,t(e)):n.push(e),n},[])},pushSet:function(n,e){-1===n.indexOf(e)&&n.push(e)},$:function(n,e){return l?e?l.querySelectorAll(n):l.querySelector(n):e?[]:null},hasClass:function(n,e){return n.classList?n.classList.contains(e):!!n.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(n,e){n.classList?n.classList.add(e):n.className+=" "+e},removeClass:function(n,e){n.classList?n.classList.remove(e):(e=new RegExp("(\\s|^)"+e+"(\\s|$)"),n.className=n.className.replace(e," "))},fromCSS:function(n,e){if(!n||!e||!e.length)return{};var t;if(n instanceof Element)t=n;else{if(!n.length)return{};t=n[0]}for(var r={},i=window.getComputedStyle(t),o=e.length,u=0;u<o;++u)r[e[u]]=i[e[u]];return r},addEvent:function(n,e,t,r){n.addEventListener(e,t,r)},removeEvent:function(n,e,t,r){n.removeEventListener(e,t,r)},getDocument:k,getDocumentElement:function(n){return k(n).documentElement},getDocumentBody:function(n){return k(n).body},getWindow:function(n){return(null==(n=null==n?void 0:n.ownerDocument)?void 0:n.defaultView)||window}}});
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):n.utils=e()}(this,function(){"use strict";function n(n){if(l){var e=(l.body||l.documentElement).style,t=p.length;if(typeof e[n]!=o)return n;for(var r=0;r<t;++r){var i="-"+p[r]+"-"+n;if(typeof e[i]!=o)return i}}return""}var u="rgb",a="rgba",c="hsl",f="hsla",j=[u,a,c,f],e="function",t="object",r="string",i="number",o="undefined",s=typeof window!=o,l=typeof document!=o&&document,p=["webkit","ms","moz","o"],B=n("transform"),U=n("filter"),d=n("animation"),_=d.replace("animation","keyframes"),w=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],m=1e-7,v={cm:function(n){return 96*n/2.54},mm:function(n){return 96*n/254},in:function(n){return 96*n},pt:function(n){return 96*n/72},pc:function(n){return 96*n/6},"%":function(n,e){return n*e/100},vw:function(n,e){return n/100*(e=void 0===e?window.innerWidth:e)},vh:function(n,e){return n/100*(e=void 0===e?window.innerHeight:e)},vmax:function(n,e){return n/100*(e=void 0===e?Math.max(window.innerWidth,window.innerHeight):e)},vmin:function(n,e){return n/100*(e=void 0===e?Math.min(window.innerWidth,window.innerHeight):e)}};function h(n){return n&&typeof n==t}function g(n){return Array.isArray(n)}function y(n){return typeof n==r}function A(n){return typeof n==e}function S(n,e,t,r,i){if(b(n,e,t))return t;for(var o,u=n,a=e,c=r,f=i,s=t+1;s<c;++s){var l=function(n){var e,t,r=a[n].trim();return r!==u.close||b(u,a,n)?(e=n,-1===(e=(t=F(f,function(n){return n.open===r}))?S(t,a,n,c,f):e)?(o=n,"break"):void(o=n=e)):{value:n}}(s);if(s=o,"object"==typeof l)return l.value;if("break"===l)break}return-1}function b(n,e,t){return n.ignore?(e=e.slice(Math.max(t-3,0),t+3).join(""),new RegExp(n.ignore).exec(e)):null}function E(o,n){var n=y(n)?{separator:n}:n,e=n.separator,u=void 0===e?",":e,a=n.isSeparateFirst,c=n.isSeparateOnlyOpenClose,e=n.isSeparateOpenClose,f=void 0===e?c:e,e=n.openCloseCharacters,s=void 0===e?w:e,n=s.map(function(n){var e=n.open,n=n.close;return e===n?e:e+"|"+n}).join("|"),e=new RegExp("(\\s*"+u+"\\s*|"+n+"|\\s+)","g"),l=o.split(e).filter(function(n){return n&&"undefined"!==n}),p=l.length,d=[],m=[];function v(){return m.length&&(d.push(m.join("")),m=[])}for(var h,t=function(n){var e=l[n].trim(),t=n,r=F(s,function(n){return n.open===e}),i=F(s,function(n){return n.close===e});if(r){if(-1!==(t=S(r,l,n,p,s))&&f)return v()&&a||(d.push(l.slice(n,t+1).join("")),n=t,a)?(h=n,"break"):(h=n,"continue")}else{if(i&&!b(i,l,n))return(r=function(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),i=0,e=0;e<t;e++)for(var o=arguments[e],u=0,a=o.length;u<a;u++,i++)r[i]=o[u];return r}(s)).splice(s.indexOf(i),1),{value:E(o,{separator:u,isSeparateFirst:a,isSeparateOnlyOpenClose:c,isSeparateOpenClose:f,openCloseCharacters:r})};if(i=e,!((""!==(r=u)&&" "!=r||""!==i&&" "!=i)&&i!==r||c))return v(),a?(h=n,"break"):(h=n,"continue")}m.push(l.slice(n,(t=-1===t?p-1:t)+1).join("")),h=n=t},r=0;r<p;++r){var i=t(r),r=h;if("object"==typeof i)return i.value;if("break"===i)break}return m.length&&d.push(m.join("")),d}function x(n){return E(n,",")}function R(n){n=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(n);return!n||n.length<4?{}:{prefix:n[1],value:n[2],suffix:n[3]}}function C(n){var e,t,n=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(n);return n?(e=n[1],t=n[2],{prefix:e,unit:n[3],value:parseFloat(t)}):{prefix:"",unit:"",value:NaN}}function M(){return Date.now?Date.now():(new Date).getTime()}function O(n,e,t){void 0===t&&(t=-1);for(var r=n.length,i=0;i<r;++i)if(e(n[i],i,n))return i;return t}function z(n,e,t){void 0===t&&(t=-1);for(var r=n.length-1;0<=r;--r)if(e(n[r],r,n))return r;return t}function F(n,e,t){e=O(n,e);return-1<e?n[e]:t}var P=function(){var t=M(),n=s&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return n?n.bind(window):function(n){var e=M();return setTimeout(function(){n(e-t)},1e3/60)}}();function N(n){return Object.keys(n)}function q(n,e,t){return Math.max(e,Math.min(n,t))}function I(n,r,i,e){return void 0===e&&(e=n[0]/n[1]),[[L(r[0],m),L(r[0]/e,m)],[L(r[1]*e,m),L(r[1],m)]].filter(function(n){return n.every(function(n,e){var e=r[e],t=L(e,m);return i?n<=e||n<=t:e<=n||t<=n})})[0]||n}function H(n){for(var e=n.length,t=0,r=e-1;0<=r;--r)t+=n[r];return e?t/e:0}function T(n,e){var t=e[0]-n[0],e=e[1]-n[1],n=Math.atan2(e,t);return 0<=n?n:n+2*Math.PI}function G(n){return[0,1].map(function(e){return H(n.map(function(n){return n[e]}))})}function L(n,e){var t;return e?(t=1/e,Math.round(n/e)/t):n}function W(n){return n.replace("#","")}function D(n){var n=W(n),e=parseInt(n.substring(0,2),16),t=parseInt(n.substring(2,4),16),r=parseInt(n.substring(4,6),16),n=parseInt(n.substring(6,8),16)/255;return[e,t,r,n=isNaN(n)?1:n]}function Y(n){var e=n.charAt(1),t=n.charAt(2),r=n.charAt(3),n=n.charAt(4);return["#",e,e,t,t,r,r,n,n].join("")}function $(n){var e=n[0],t=n[1],r=n[2],t=(e<0&&(e+=360*Math.floor((Math.abs(e)+360)/360)),e%=360,(1-Math.abs(2*r-1))*t),i=t*(1-Math.abs(e/60%2-1)),r=r-t/2,e=e<60?[t,i,0]:e<120?[i,t,0]:e<180?[0,t,i]:e<240?[0,i,t]:e<300?[i,0,t]:e<360?[t,0,i]:[0,0,0];return[Math.round(255*(e[0]+r)),Math.round(255*(e[1]+r)),Math.round(255*(e[2]+r)),null!=(t=n[3])?t:1]}function k(n){return(null==n?void 0:n.ownerDocument)||l}function V(n){return(null==(n=null==n?void 0:n.ownerDocument)?void 0:n.defaultView)||window}return{RGB:u,RGBA:a,HSL:c,HSLA:f,COLOR_MODELS:j,FUNCTION:e,PROPERTY:"property",ARRAY:"array",OBJECT:t,STRING:r,NUMBER:i,UNDEFINED:o,IS_WINDOW:s,document:l,getCrossBrowserProperty:n,TRANSFORM:B,FILTER:U,ANIMATION:d,KEYFRAMES:_,OPEN_CLOSED_CHARACTERS:w,TINY_NUM:m,REVERSE_TINY_NUM:1e7,DEFAULT_UNIT_PRESETS:v,cutHex:W,hexToRGBA:D,toFullHex:Y,hslToRGBA:$,stringToRGBA:function(n){if("#"===n.charAt(0))return 4===n.length||5===n.length?D(Y(n)):D(n);if(-1!==n.indexOf("(")){var n=R(n),e=n.prefix,n=n.value;if(!e||!n)return;var t=x(n),r=[0,0,0,1],i=t.length;switch(e){case u:case a:for(var o=0;o<i;++o)r[o]=parseFloat(t[o]);return r;case c:case f:for(o=0;o<i;++o)-1!==t[o].indexOf("%")?r[o]=parseFloat(t[o])/100:r[o]=parseFloat(t[o]);return $(r)}}},dot:function(n,e,t,r){return(n*r+e*t)/(t+r)},isUndefined:function(n){return typeof n==o},isObject:h,isArray:g,isString:y,isNumber:function(n){return typeof n==i},isFunction:A,splitText:E,splitSpace:function(n){return E(n,"")},splitComma:x,splitBracket:R,splitUnit:C,camelize:function(n){return n.replace(/[\s-_]+([^\s-_])/g,function(n,e){return e.toUpperCase()})},decamelize:function(n,r){return void 0===r&&(r="-"),n.replace(/([a-z])([A-Z])/g,function(n,e,t){return""+e+r+t.toLowerCase()})},toArray:function(n){return[].slice.call(n)},now:M,findIndex:O,findLastIndex:z,findLast:function(n,e,t){return-1<(e=z(n,e))?n[e]:t},find:F,requestAnimationFrame:P,cancelAnimationFrame:function(){var n=s&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return n?n.bind(window):function(n){clearTimeout(n)}}(),getKeys:N,getValues:function(e){return N(e).map(function(n){return e[n]})},getEntries:function(e){return N(e).map(function(n){return[n,e[n]]})},sortOrders:function(n,t){void 0===t&&(t=[]),n.sort(function(n,e){n=t.indexOf(n),e=t.indexOf(e);return-1===e&&-1===n?0:-1===n?1:-1===e?-1:n-e})},convertUnitSize:function(n,e){var t=(n=C(n)).value,n=n.unit;if(h(e)){var r=e[n];if(r){if(A(r))return r(t);if(v[n])return v[n](t,r)}}else if("%"===n)return t*e/100;return v[n]?v[n](t):t},between:q,checkBoundSize:I,calculateBoundSize:function(n,t,r,e){var i,o,u,a,c;return e?(i=n[0],o=n[1],u=(a=I(n,t,!1,e=!0===e?i/o:e))[0],a=a[1],c=(e=I(n,r,!0,e))[0],e=e[1],i<u||o<a?(i=u,o=a):(c<i||e<o)&&(i=c,o=e),[i,o]):n.map(function(n,e){return q(n,t[e],r[e])})},sum:function(n){for(var e=0,t=n.length-1;0<=t;--t)e+=n[t];return e},average:H,getRad:T,getCenterPoint:G,getShapeDirection:function(n){var e=T(t=G(n),n[0]),t=T(t,n[1]);return e<t&&t-e<Math.PI||t<e&&t-e<-Math.PI?1:-1},getDist:function(n,e){return Math.sqrt(Math.pow((e?e[0]:0)-n[0],2)+Math.pow((e?e[1]:0)-n[1],2))},throttle:L,throttleArray:function(t,r){return t.forEach(function(n,e){t[e]=L(t[e],r)}),t},counter:function(n){for(var e=[],t=0;t<n;++t)e.push(t);return e},replaceOnce:function(n,e,t){var r=!1;return n.replace(e,function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return r?n[0]:(r=!0,y(t)?t:t.apply(void 0,n))})},flat:function(n){return n.reduce(function(n,e){return n.concat(e)},[])},deepFlat:function t(n){return n.reduce(function(n,e){return g(e)?n.push.apply(n,t(e)):n.push(e),n},[])},pushSet:function(n,e){-1===n.indexOf(e)&&n.push(e)},$:function(n,e){return l?e?l.querySelectorAll(n):l.querySelector(n):e?[]:null},hasClass:function(n,e){return n.classList?n.classList.contains(e):!!n.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(n,e){n.classList?n.classList.add(e):n.className+=" "+e},removeClass:function(n,e){n.classList?n.classList.remove(e):(e=new RegExp("(\\s|^)"+e+"(\\s|$)"),n.className=n.className.replace(e," "))},fromCSS:function(n,e){if(!n||!e||!e.length)return{};var t;if(n instanceof Element)t=n;else{if(!n.length)return{};t=n[0]}for(var r={},i=V(t).getComputedStyle(t),o=e.length,u=0;u<o;++u)r[e[u]]=i[e[u]];return r},addEvent:function(n,e,t,r){n.addEventListener(e,t,r)},removeEvent:function(n,e,t,r){n.removeEventListener(e,t,r)},getDocument:k,getDocumentElement:function(n){return k(n).documentElement},getDocumentBody:function(n){return k(n).body},getWindow:V}});
//# sourceMappingURL=utils.min.js.map
{
"name": "@daybrush/utils",
"version": "1.12.1",
"version": "1.12.2",
"description": "utils for daybrush",

@@ -5,0 +5,0 @@ "main": "dist/utils.cjs.js",

@@ -121,3 +121,3 @@ import { document } from "./consts";

const cssObject: IObject<any> = {};
const styles = window.getComputedStyle(element) as any;
const styles = getWindow(element).getComputedStyle(element) as any;
const length = properties.length;

@@ -124,0 +124,0 @@

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