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.19 to 0.8.2

2

dist/utils.common.js
/*!
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* @pluginjs/utils v0.8.2 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited

@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License.

/*!
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* @pluginjs/utils v0.8.2 (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;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@pluginjs/is");function e(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function t(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 n(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var o=e=>{if(r.isElement(e))return e;if(r.isArray(e))return e.slice();if(r.isDate(e))return new e.constructor(Number(e));if(r.isMap(e))return new Map(e);if(r.isSet(e))return new Set(e);if(r.isSymbol(e))return Symbol.prototype.valueOf?Object(Symbol.prototype.valueOf.call(e)):{};if(r.isRegexp(e)){var t=new e.constructor(e.source,/\w+$/.exec(e));return t.lastIndex=e.lastIndex,t}return r.isError(e)?Object.create(e):r.isPlainObject(e)?Object.assign({},e):e},a=e=>r.isPlainObject(e)?i(e):r.isArray(e)?c(e):o(e),i=e=>{if(r.isPlainObject(e)){var t=new e.constructor;for(var n in e)t[n]=a(e[n]);return t}return e},c=r=>{for(var e=new r.constructor(r.length),t=0;t<r.length;t++)e[t]=a(r[t]);return e};function s(e,t){var n=r.isArray(t),a=r.isArray(e);return r.isUndefined(t)?e:n!==a?o(t):n?o(t):r.isPlainObject(e)&&r.isPlainObject(t)?(Object.keys(t).forEach(r=>{e[r]=s(e[r],t[r])}),e):o(t)}var u=(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},l=(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.isArray(e[i])&&r.isArray(t[i])){if(!u(e[i],t[i]))return!1}else if(r.isObject(e[i])&&r.isObject(t[i])){if(!l(e[i],t[i]))return!1}else if(e[i]!==t[i])return!1}return!0};exports.SvgElement=(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},exports.arrayDiff=(r,e)=>r.filter(r=>e.indexOf(r)<0),exports.arrayEqual=u,exports.arrayIntersect=(r,e)=>{var t;return e.length>r.length&&(t=e,e=r,r=t),r.filter(r=>-1!==e.indexOf(r))},exports.camelize=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},exports.clone=o,exports.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((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},exports.convertFloatToPercentage=r=>(r<0?r=0:r>1&&(r=1),"".concat(100*parseFloat(r).toFixed(4),"%")),exports.convertMatrixToArray=r=>!(!r||"matrix"!==r.substr(0,6))&&r.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/),exports.convertPercentageToFloat=r=>parseFloat(r.slice(0,-1)/100,10),exports.curry=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 c=t.concat(a);return c.length>=n?e(...c):r(e,c)}},exports.curryWith=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 c=a.findIndex(t);if(c>=0){var s=n.concat(...a.slice(0,c+1));return e(...s)}var u=n.concat(...a);return r(e,t,u)}},exports.dasherize=r=>r.replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase(),exports.debounce=function(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 c=t;e&&(clearTimeout(e),e=null),e=setTimeout(()=>{r.apply(c,a)},n)}},exports.deepClone=a,exports.deepCloneArray=c,exports.deepCloneObject=i,exports.deepMerge=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(r.isObject).reduce(s,{})},exports.each=(e,t)=>{if(r.isArray(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},exports.fromPairs=function(r){return r.reduce((r,e)=>{var[t,o]=e;return n({},r,{[t]:o})},{})},exports.getTime=()=>void 0!==window.performance&&window.performance.now?window.performance.now():Date.now(),exports.getUID=r=>{do{r+=~~(1e6*Math.random())}while(document.getElementById(r));return r},exports.getValueByPath=(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}},exports.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(e=>{for(var t in e)r[t]=e[t]}),r},exports.nub=r=>Array.from(new Set(r)),exports.objectEqual=l,exports.parseDataOptions=function(r){return Object.entries(r).reduce((r,e)=>{var[t,o]=e;try{return n({},r,{[t]:JSON.parse('{"data": '.concat(o.replace(/'/g,'"'),"}")).data})}catch(e){return n({},r,{[t]:o})}},{})},exports.range=r=>Array.from({length:r},(r,e)=>e),exports.reflow=r=>r.offsetHeight,exports.throttle=function(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,c=new Array(i),s=0;s<i;s++)c[s]=arguments[s];r.apply(a,c),window.setTimeout(o,e)}}:function(){for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];var c=t;n||(n=!0,window.requestAnimationFrame(()=>{r.apply(c,a),o()}))}},exports.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)};
/*!
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* @pluginjs/utils v0.8.2 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited

@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License.

/*!
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* @pluginjs/utils v0.8.2 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited

@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License.

/*!
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* @pluginjs/utils v0.8.2 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited

@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License.

/*!
* @pluginjs/utils v0.7.19 (https://pluginjs.com)
* @pluginjs/utils v0.8.2 (https://pluginjs.com)
* Copyright 2020 Creation Studio Limited

@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License.

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

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

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

"devDependencies": {
"@babel/core": "^7.7.5",
"@pluginjs/browserslist-config": "^1.2.14",
"@pluginjs/cli": "^0.7.15",
"@babel/core": "^7.8.4",
"@pluginjs/browserslist-config": "^1.3.0",
"@pluginjs/cli": "^0.7.16",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"babel-jest": "*",

@@ -48,6 +50,4 @@ "jest": "*",

"rename": "^1.0.4",
"rollup": "*",
"rollup": "^1.31.0",
"rollup-plugin-babel": "*",
"rollup-plugin-commonjs": "*",
"rollup-plugin-node-resolve": "*",
"rollup-plugin-terser": "*"

@@ -70,3 +70,3 @@ },

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