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

@pluginjs/utils

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pluginjs/utils - npm Package Compare versions

Comparing version 0.7.18 to 0.7.19

4

dist/utils.common.js
/*!
* @pluginjs/utils v0.7.18 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited
* Released under the GPL-3.0 License.

@@ -5,0 +5,0 @@ */

/*!
* @pluginjs/utils v0.7.18 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var is=require("@pluginjs/is");function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var nub=e=>Array.from(new Set(e)),each=(e,r)=>{if(is.isArray(e))for(var t=0,n=e.length;t<n;t++)r(e[t],t);else Object.entries(e).map(e=>{var[t,n]=e;return r(t,n)});return e};function triggerNative(e,r,t){var n=document.createEvent("HTMLEvents");void 0!==t?n.initCustomEvent(r,!0,!0,t):n.initEvent(r,!0,!1),e.dispatchEvent(n)}var clone=e=>{if(is.isElement(e))return e;if(is.isArray(e))return e.slice();if(is.isDate(e))return new e.constructor(Number(e));if(is.isMap(e))return new Map(e);if(is.isSet(e))return new Set(e);if(is.isSymbol(e))return Symbol.prototype.valueOf?Object(Symbol.prototype.valueOf.call(e)):{};if(is.isRegexp(e)){var r=new e.constructor(e.source,/\w+$/.exec(e));return r.lastIndex=e.lastIndex,r}return is.isError(e)?Object.create(e):is.isPlainObject(e)?Object.assign({},e):e},deepClone=e=>is.isPlainObject(e)?deepCloneObject(e):is.isArray(e)?deepCloneArray(e):clone(e),deepCloneObject=e=>{if(is.isPlainObject(e)){var r=new e.constructor;for(var t in e)r[t]=deepClone(e[t]);return r}return e},deepCloneArray=e=>{for(var r=new e.constructor(e.length),t=0;t<e.length;t++)r[t]=deepClone(e[t]);return r},merge=function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return t.forEach(r=>{for(var t in r)e[t]=r[t]}),e};function deepMergeTwo(e,r){var t=is.isArray(r),n=is.isArray(e);return is.isUndefined(r)?e:t!==n?clone(r):t?clone(r):is.isPlainObject(e)&&is.isPlainObject(r)?(Object.keys(r).forEach(t=>{e[t]=deepMergeTwo(e[t],r[t])}),e):clone(r)}var deepMerge=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.filter(is.isObject).reduce(deepMergeTwo,{})},curry=function e(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(){for(var n=r.currylen||r.length,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];var c=t.concat(a);return c.length>=n?r(...c):e(r,c)}},curryWith=function e(r,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return function(){for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];var c=a.findIndex(t);if(c>=0){var s=n.concat(...a.slice(0,c+1));return r(...s)}var l=n.concat(...a);return e(r,t,l)}},compose=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.reduceRight((e,t,n)=>Array.isArray(e)&&n===r.length-1?t(...e):t(e),t)};return n.currylen=r[r.curylen||r.length-1].length,n},MAX_UID=1e6,getUID=e=>{do{e+=~~(Math.random()*MAX_UID)}while(document.getElementById(e));return e},range=e=>Array.from({length:e},(e,r)=>r),reflow=e=>e.offsetHeight,arrayEqual=(e,r)=>{if(e===r)return!0;if(void 0===e||void 0===r)return!1;if(e.length!==r.length)return!1;for(var t=0;t<e.length;++t)if(e[t]!==r[t])return!1;return!0},objectEqual=(e,r)=>{var t=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(r);if(t.length!==n.length)return!1;for(var o=0;o<t.length;o++){var a=t[o];if(is.isArray(e[a])&&is.isArray(r[a])){if(!arrayEqual(e[a],r[a]))return!1}else if(is.isObject(e[a])&&is.isObject(r[a])){if(!objectEqual(e[a],r[a]))return!1}else if(e[a]!==r[a])return!1}return!0},arrayDiff=(e,r)=>e.filter(e=>r.indexOf(e)<0),arrayIntersect=(e,r)=>{var t;return r.length>e.length&&(t=r,r=e,e=t),e.filter(e=>-1!==r.indexOf(e))},convertPercentageToFloat=e=>parseFloat(e.slice(0,-1)/100,10),convertFloatToPercentage=e=>(e<0?e=0:e>1&&(e=1),"".concat(100*parseFloat(e).toFixed(4),"%")),convertMatrixToArray=e=>!(!e||"matrix"!==e.substr(0,6))&&e.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/),getTime=()=>void 0!==window.performance&&window.performance.now?window.performance.now():Date.now(),camelize=function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e=e.replace(/[_.\- ]+(\w|$)/g,(e,r)=>r.toUpperCase()),r&&(e=e.substring(0,1).toUpperCase()+e.substring(1)),e},dasherize=e=>e.replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase(),getValueByPath=(e,r)=>{if(Object(e)!==e||void 0===r)return e;if(r in e)return e[r];var t=r.split("."),n=t.length;if(n){for(var o=-1;e&&++o<n;){for(var a=t[o];"\\"===a[a.length-1];)a="".concat(a.slice(0,-1),".").concat(t[++o]);e=e[a]}return e}};function throttle(e,r){var t=this,n=!1;function o(){n=!1}return void 0!==r||null!==r?function(){var a=t;if(!n){n=!0;for(var i=arguments.length,c=new Array(i),s=0;s<i;s++)c[s]=arguments[s];e.apply(a,c),window.setTimeout(o,r)}}:function(){for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];var c=t;n||(n=!0,window.requestAnimationFrame(()=>{e.apply(c,a),o()}))}}function debounce(e){var r,t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];var c=t;r&&(clearTimeout(r),r=null),r=setTimeout(()=>{e.apply(c,a)},n)}}function fromPairs(e){return e.reduce((e,r)=>{var[t,n]=r;return _objectSpread2({},e,{[t]:n})},{})}var SvgElement=(e,r)=>{var t=document.createElementNS("http://www.w3.org/2000/svg",e);if(!r)return t;for(var n in r)Object.hasOwnProperty.call(r,n)&&t.setAttribute(n,r[n]);return t};function parseDataOptions(e){return Object.entries(e).reduce((e,r)=>{var[t,n]=r;try{return _objectSpread2({},e,{[t]:JSON.parse('{"data": '.concat(n.replace(/'/g,'"'),"}")).data})}catch(r){return _objectSpread2({},e,{[t]:n})}},{})}exports.SvgElement=SvgElement,exports.arrayDiff=arrayDiff,exports.arrayEqual=arrayEqual,exports.arrayIntersect=arrayIntersect,exports.camelize=camelize,exports.clone=clone,exports.compose=compose,exports.convertFloatToPercentage=convertFloatToPercentage,exports.convertMatrixToArray=convertMatrixToArray,exports.convertPercentageToFloat=convertPercentageToFloat,exports.curry=curry,exports.curryWith=curryWith,exports.dasherize=dasherize,exports.debounce=debounce,exports.deepClone=deepClone,exports.deepCloneArray=deepCloneArray,exports.deepCloneObject=deepCloneObject,exports.deepMerge=deepMerge,exports.each=each,exports.fromPairs=fromPairs,exports.getTime=getTime,exports.getUID=getUID,exports.getValueByPath=getValueByPath,exports.merge=merge,exports.nub=nub,exports.objectEqual=objectEqual,exports.parseDataOptions=parseDataOptions,exports.range=range,exports.reflow=reflow,exports.throttle=throttle,exports.triggerNative=triggerNative;
/*!
* @pluginjs/utils v0.7.18 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited
* Released under the GPL-3.0 License.

@@ -5,0 +5,0 @@ */

/*!
* @pluginjs/utils v0.7.18 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
import{isArray as r,isElement as e,isDate as t,isMap as n,isSet as o,isSymbol as a,isRegexp as i,isError as u,isPlainObject as c,isObject as f,isUndefined as l}from"@pluginjs/is";function v(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function s(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function g(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?s(Object(t),!0).forEach((function(e){v(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var p=r=>Array.from(new Set(r)),h=(e,t)=>{if(r(e))for(var n=0,o=e.length;n<o;n++)t(e[n],n);else Object.entries(e).map(r=>{var[e,n]=r;return t(e,n)});return e};function w(r,e,t){var n=document.createEvent("HTMLEvents");void 0!==t?n.initCustomEvent(e,!0,!0,t):n.initEvent(e,!0,!1),r.dispatchEvent(n)}var y=f=>{if(e(f))return f;if(r(f))return f.slice();if(t(f))return new f.constructor(Number(f));if(n(f))return new Map(f);if(o(f))return new Set(f);if(a(f))return Symbol.prototype.valueOf?Object(Symbol.prototype.valueOf.call(f)):{};if(i(f)){var l=new f.constructor(f.source,/\w+$/.exec(f));return l.lastIndex=f.lastIndex,l}return u(f)?Object.create(f):c(f)?Object.assign({},f):f},d=e=>c(e)?O(e):r(e)?b(e):y(e),O=r=>{if(c(r)){var e=new r.constructor;for(var t in r)e[t]=d(r[t]);return e}return r},b=r=>{for(var e=new r.constructor(r.length),t=0;t<r.length;t++)e[t]=d(r[t]);return e},m=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return t.forEach(e=>{for(var t in e)r[t]=e[t]}),r};function j(e,t){var n=r(t),o=r(e);return l(t)?e:n!==o?y(t):n?y(t):c(e)&&c(t)?(Object.keys(t).forEach(r=>{e[r]=j(e[r],t[r])}),e):y(t)}var A=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter(f).reduce(j,{})},P=function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(){for(var n=e.currylen||e.length,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];var u=t.concat(a);return u.length>=n?e(...u):r(e,u)}},E=function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return function(){for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];var u=a.findIndex(t);if(u>=0){var c=n.concat(...a.slice(0,u+1));return e(...c)}var f=n.concat(...a);return r(e,t,f)}},x=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return e.reduceRight((r,t,n)=>Array.isArray(r)&&n===e.length-1?t(...r):t(r),t)};return n.currylen=e[e.curylen||e.length-1].length,n},S=r=>{do{r+=~~(1e6*Math.random())}while(document.getElementById(r));return r},$=r=>Array.from({length:r},(r,e)=>e),D=r=>r.offsetHeight,N=(r,e)=>{if(r===e)return!0;if(void 0===r||void 0===e)return!1;if(r.length!==e.length)return!1;for(var t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0},C=(e,t)=>{var n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(var a=0;a<n.length;a++){var i=n[a];if(r(e[i])&&r(t[i])){if(!N(e[i],t[i]))return!1}else if(f(e[i])&&f(t[i])){if(!C(e[i],t[i]))return!1}else if(e[i]!==t[i])return!1}return!0},F=(r,e)=>r.filter(r=>e.indexOf(r)<0),I=(r,e)=>{var t;return e.length>r.length&&(t=e,e=r,r=t),r.filter(r=>-1!==e.indexOf(r))},T=r=>parseFloat(r.slice(0,-1)/100,10),M=r=>(r<0?r=0:r>1&&(r=1),"".concat(100*parseFloat(r).toFixed(4),"%")),k=r=>!(!r||"matrix"!==r.substr(0,6))&&r.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/),H=()=>void 0!==window.performance&&window.performance.now?window.performance.now():Date.now(),L=function(r){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return r=r.replace(/[_.\- ]+(\w|$)/g,(r,e)=>e.toUpperCase()),e&&(r=r.substring(0,1).toUpperCase()+r.substring(1)),r},U=r=>r.replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase(),q=(r,e)=>{if(Object(r)!==r||void 0===e)return r;if(e in r)return r[e];var t=e.split("."),n=t.length;if(n){for(var o=-1;r&&++o<n;){for(var a=t[o];"\\"===a[a.length-1];)a="".concat(a.slice(0,-1),".").concat(t[++o]);r=r[a]}return r}};function z(r,e){var t=this,n=!1;function o(){n=!1}return void 0!==e||null!==e?function(){var a=t;if(!n){n=!0;for(var i=arguments.length,u=new Array(i),c=0;c<i;c++)u[c]=arguments[c];r.apply(a,u),window.setTimeout(o,e)}}:function(){for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];var u=t;n||(n=!0,window.requestAnimationFrame(()=>{r.apply(u,a),o()}))}}function B(r){var e,t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];var u=t;e&&(clearTimeout(e),e=null),e=setTimeout(()=>{r.apply(u,a)},n)}}function J(r){return r.reduce((r,e)=>{var[t,n]=e;return g({},r,{[t]:n})},{})}var R=(r,e)=>{var t=document.createElementNS("http://www.w3.org/2000/svg",r);if(!e)return t;for(var n in e)Object.hasOwnProperty.call(e,n)&&t.setAttribute(n,e[n]);return t};function Z(r){return Object.entries(r).reduce((r,e)=>{var[t,n]=e;try{return g({},r,{[t]:JSON.parse('{"data": '.concat(n.replace(/'/g,'"'),"}")).data})}catch(e){return g({},r,{[t]:n})}},{})}export{R as SvgElement,F as arrayDiff,N as arrayEqual,I as arrayIntersect,L as camelize,y as clone,x as compose,M as convertFloatToPercentage,k as convertMatrixToArray,T as convertPercentageToFloat,P as curry,E as curryWith,U as dasherize,B as debounce,d as deepClone,b as deepCloneArray,O as deepCloneObject,A as deepMerge,h as each,J as fromPairs,H as getTime,S as getUID,q as getValueByPath,m as merge,p as nub,C as objectEqual,Z as parseDataOptions,$ as range,D as reflow,z as throttle,w as triggerNative};
/*!
* @pluginjs/utils v0.7.18 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited
* Released under the GPL-3.0 License.

@@ -5,0 +5,0 @@ */

/*!
* @pluginjs/utils v0.7.18 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@pluginjs/is")):"function"==typeof define&&define.amd?define(["exports","@pluginjs/is"],e):e((r=r||self)["@pluginjs/utils"]={},r["@pluginjs/is"])}(this,(function(r,e){"use strict";function t(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function n(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function i(r){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach((function(e){t(r,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}function o(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){if(!(Symbol.iterator in Object(r)||"[object Arguments]"===Object.prototype.toString.call(r)))return;var t=[],n=!0,i=!1,o=void 0;try{for(var u,a=r[Symbol.iterator]();!(n=(u=a.next()).done)&&(t.push(u.value),!e||t.length!==e);n=!0);}catch(r){i=!0,o=r}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(r){return function(r){if(Array.isArray(r)){for(var e=0,t=new Array(r.length);e<r.length;e++)t[e]=r[e];return t}}(r)||function(r){if(Symbol.iterator in Object(r)||"[object Arguments]"===Object.prototype.toString.call(r))return Array.from(r)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var a=function(r){if(e.isElement(r))return r;if(e.isArray(r))return r.slice();if(e.isDate(r))return new r.constructor(Number(r));if(e.isMap(r))return new Map(r);if(e.isSet(r))return new Set(r);if(e.isSymbol(r))return Symbol.prototype.valueOf?Object(Symbol.prototype.valueOf.call(r)):{};if(e.isRegexp(r)){var t=new r.constructor(r.source,/\w+$/.exec(r));return t.lastIndex=r.lastIndex,t}return e.isError(r)?Object.create(r):e.isPlainObject(r)?Object.assign({},r):r},c=function(r){return e.isPlainObject(r)?f(r):e.isArray(r)?l(r):a(r)},f=function(r){if(e.isPlainObject(r)){var t=new r.constructor;for(var n in r)t[n]=c(r[n]);return t}return r},l=function(r){for(var e=new r.constructor(r.length),t=0;t<r.length;t++)e[t]=c(r[t]);return e};function s(r,t){var n=e.isArray(t),i=e.isArray(r);return e.isUndefined(t)?r:n!==i?a(t):n?a(t):e.isPlainObject(r)&&e.isPlainObject(t)?(Object.keys(t).forEach((function(e){r[e]=s(r[e],t[e])})),r):a(t)}var p=function(r,e){if(r===e)return!0;if(void 0===r||void 0===e)return!1;if(r.length!==e.length)return!1;for(var t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0};r.SvgElement=function(r,e){var t=document.createElementNS("http://www.w3.org/2000/svg",r);if(!e)return t;for(var n in e)Object.hasOwnProperty.call(e,n)&&t.setAttribute(n,e[n]);return t},r.arrayDiff=function(r,e){return r.filter((function(r){return e.indexOf(r)<0}))},r.arrayEqual=p,r.arrayIntersect=function(r,e){var t;return e.length>r.length&&(t=e,e=r,r=t),r.filter((function(r){return-1!==e.indexOf(r)}))},r.camelize=function(r){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return r=r.replace(/[_.\- ]+(\w|$)/g,(function(r,e){return e.toUpperCase()})),e&&(r=r.substring(0,1).toUpperCase()+r.substring(1)),r},r.clone=a,r.compose=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return e.reduceRight((function(r,t,n){return Array.isArray(r)&&n===e.length-1?t.apply(void 0,u(r)):t(r)}),t)};return n.currylen=e[e.curylen||e.length-1].length,n},r.convertFloatToPercentage=function(r){return r<0?r=0:r>1&&(r=1),"".concat(100*parseFloat(r).toFixed(4),"%")},r.convertMatrixToArray=function(r){return!(!r||"matrix"!==r.substr(0,6))&&r.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/)},r.convertPercentageToFloat=function(r){return parseFloat(r.slice(0,-1)/100,10)},r.curry=function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(){for(var n=e.currylen||e.length,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var c=t.concat(o);return c.length>=n?e.apply(void 0,u(c)):r(e,c)}},r.curryWith=function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var c=o.findIndex(t);if(c>=0){var f=n.concat.apply(n,u(o.slice(0,c+1)));return e.apply(void 0,u(f))}var l=n.concat.apply(n,o);return r(e,t,l)}},r.dasherize=function(r){return r.replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase()},r.debounce=function(r){var e,t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var i=arguments.length,o=new Array(i),u=0;u<i;u++)o[u]=arguments[u];var a=t;e&&(clearTimeout(e),e=null),e=setTimeout((function(){r.apply(a,o)}),n)}},r.deepClone=c,r.deepCloneArray=l,r.deepCloneObject=f,r.deepMerge=function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return t.filter(e.isObject).reduce(s,{})},r.each=function(r,t){if(e.isArray(r))for(var n=0,i=r.length;n<i;n++)t(r[n],n);else Object.entries(r).map((function(r){var e=o(r,2),n=e[0],i=e[1];return t(n,i)}));return r},r.fromPairs=function(r){return r.reduce((function(r,e){var n=o(e,2);return i({},r,t({},n[0],n[1]))}),{})},r.getTime=function(){return void 0!==window.performance&&window.performance.now?window.performance.now():Date.now()},r.getUID=function(r){do{r+=~~(1e6*Math.random())}while(document.getElementById(r));return r},r.getValueByPath=function(r,e){if(Object(r)!==r||void 0===e)return r;if(e in r)return r[e];var t=e.split("."),n=t.length;if(n){for(var i=-1;r&&++i<n;){for(var o=t[i];"\\"===o[o.length-1];)o="".concat(o.slice(0,-1),".").concat(t[++i]);r=r[o]}return r}},r.merge=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return t.forEach((function(e){for(var t in e)r[t]=e[t]})),r},r.nub=function(r){return Array.from(new Set(r))},r.objectEqual=function r(t,n){var i=Object.getOwnPropertyNames(t),o=Object.getOwnPropertyNames(n);if(i.length!==o.length)return!1;for(var u=0;u<i.length;u++){var a=i[u];if(e.isArray(t[a])&&e.isArray(n[a])){if(!p(t[a],n[a]))return!1}else if(e.isObject(t[a])&&e.isObject(n[a])){if(!r(t[a],n[a]))return!1}else if(t[a]!==n[a])return!1}return!0},r.parseDataOptions=function(r){return Object.entries(r).reduce((function(r,e){var n=o(e,2),u=n[0],a=n[1];try{return i({},r,t({},u,JSON.parse('{"data": '.concat(a.replace(/'/g,'"'),"}")).data))}catch(e){return i({},r,t({},u,a))}}),{})},r.range=function(r){return Array.from({length:r},(function(r,e){return e}))},r.reflow=function(r){return r.offsetHeight},r.throttle=function(r,e){var t=this,n=!1;function i(){n=!1}return void 0!==e||null!==e?function(){var o=t;if(!n){n=!0;for(var u=arguments.length,a=new Array(u),c=0;c<u;c++)a[c]=arguments[c];r.apply(o,a),window.setTimeout(i,e)}}:function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];var a=t;n||(n=!0,window.requestAnimationFrame((function(){r.apply(a,o),i()})))}},r.triggerNative=function(r,e,t){var n=document.createEvent("HTMLEvents");void 0!==t?n.initCustomEvent(e,!0,!0,t):n.initEvent(e,!0,!1),r.dispatchEvent(n)},Object.defineProperty(r,"__esModule",{value:!0})}));

@@ -14,3 +14,3 @@ {

},
"version": "0.7.18",
"version": "0.7.19",
"category": "utils",

@@ -37,7 +37,7 @@ "main": "dist/utils.common.js",

"dependencies": {
"@pluginjs/is": "^0.7.17"
"@pluginjs/is": "^0.7.18"
},
"devDependencies": {
"@babel/core": "^7.7.5",
"@pluginjs/browserslist-config": "^1.2.12",
"@pluginjs/browserslist-config": "^1.2.14",
"@pluginjs/cli": "^0.7.15",

@@ -69,3 +69,3 @@ "babel-jest": "*",

],
"gitHead": "f0767d4ff57027169d885ad7a3a46dbc4ff5cf7f"
"gitHead": "45f59203aaa9720d1fb61f5e96cde6d73b4cf2c8"
}
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