@pluginjs/utils
Advanced tools
Comparing version 0.7.4 to 0.7.5
/*! | ||
* @pluginjs/utils v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/utils v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
@@ -5,0 +5,0 @@ */ |
/*! | ||
* @pluginjs/utils v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/utils v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 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 _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){_defineProperty(e,r,t[r])})}return e}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_nonIterableRest()}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArrayLimit(e,r){var t=[],n=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return t}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}const nub=e=>Array.from(new Set(e)),each=(e,r)=>{if(is.isArray(e)){let t=0;const n=e.length;for(;t<n;t++)r(e[t],t)}else Object.entries(e).map(e=>{let t=_slicedToArray(e,2),n=t[0],o=t[1];return r(n,o)});return e},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)){const 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)){const r=new e.constructor;for(const t in e)r[t]=deepClone(e[t]);return r}return e},deepCloneArray=e=>{const r=new e.constructor(e.length);for(let 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(const t in r)e[t]=r[t]}),e};function deepMergeTwo(e,r){const 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)}const 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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(){const n=r.currylen||r.length;for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];const c=t.concat(i);return c.length>=n?r(...c):e(r,c)}},curryWith=function e(r,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];const c=i.findIndex(t);if(c>=0){const e=n.concat(...i.slice(0,c+1));return r(...e)}const s=n.concat(...i);return e(r,t,s)}},compose=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];const 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+=~~(1e6*Math.random())}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(let t=0;t<e.length;++t)if(e[t]!==r[t])return!1;return!0},objectEqual=(e,r)=>{const t=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(r);if(t.length!==n.length)return!1;for(let n=0;n<t.length;n++){const o=t[n];if(is.isArray(e[o])&&is.isArray(r[o])){if(!arrayEqual(e[o],r[o]))return!1}else if(is.isObject(e[o])&&is.isObject(r[o])){if(!objectEqual(e[o],r[o]))return!1}else if(e[o]!==r[o])return!1}return!0},arrayDiff=(e,r)=>e.filter(e=>r.indexOf(e)<0),arrayIntersect=(e,r)=>{let 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),`${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){let 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];const t=r.split("."),n=t.length;if(!n)return;let o=-1;for(;e&&++o<n;){let r=t[o];for(;"\\"===r[r.length-1];)r=`${r.slice(0,-1)}.${t[++o]}`;e=e[r]}return e};function throttle(e,r){var t=this;let n=!1;function o(){n=!1}return void 0!==r||null!==r?function(){const i=t;if(!n){n=!0;for(var a=arguments.length,c=new Array(a),s=0;s<a;s++)c[s]=arguments[s];e.apply(i,c),window.setTimeout(o,r)}}:function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];const c=t;n||(n=!0,window.requestAnimationFrame(()=>{e.apply(c,i),o()}))}}function debounce(e){var r=this;let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];const c=r;t&&(clearTimeout(t),t=null),t=setTimeout(()=>{e.apply(c,i)},n)}}function fromPairs(e){return e.reduce((e,r)=>{let t=_slicedToArray(r,2);return _objectSpread({},e,{[t[0]]:t[1]})},{})}const SvgElement=(e,r)=>{const t=document.createElementNS("http://www.w3.org/2000/svg",e);if(!r)return t;for(const e in r)Object.hasOwnProperty.call(r,e)&&t.setAttribute(e,r[e]);return t};function parseDataOptions(e){return Object.entries(e).reduce((e,r)=>{let t=_slicedToArray(r,2),n=t[0],o=t[1];try{return _objectSpread({},e,{[n]:JSON.parse(`{"data": ${o.replace(/'/g,'"')}}`).data})}catch(r){return _objectSpread({},e,{[n]:o})}},{})}exports.nub=nub,exports.each=each,exports.clone=clone,exports.deepClone=deepClone,exports.deepCloneObject=deepCloneObject,exports.deepCloneArray=deepCloneArray,exports.merge=merge,exports.deepMerge=deepMerge,exports.curry=curry,exports.curryWith=curryWith,exports.compose=compose,exports.getUID=getUID,exports.range=range,exports.reflow=reflow,exports.arrayEqual=arrayEqual,exports.objectEqual=objectEqual,exports.arrayDiff=arrayDiff,exports.arrayIntersect=arrayIntersect,exports.convertPercentageToFloat=convertPercentageToFloat,exports.convertFloatToPercentage=convertFloatToPercentage,exports.convertMatrixToArray=convertMatrixToArray,exports.getTime=getTime,exports.camelize=camelize,exports.dasherize=dasherize,exports.getValueByPath=getValueByPath,exports.throttle=throttle,exports.debounce=debounce,exports.fromPairs=fromPairs,exports.SvgElement=SvgElement,exports.parseDataOptions=parseDataOptions; |
/*! | ||
* @pluginjs/utils v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/utils v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
@@ -5,0 +5,0 @@ */ |
/*! | ||
* @pluginjs/utils v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/utils v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
*/ | ||
import{isDate,isMap,isSet,isSymbol,isRegexp,isError,isArray,isObject,isPlainObject,isUndefined,isElement}from"@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 _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){_defineProperty(e,r,t[r])})}return e}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_nonIterableRest()}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArrayLimit(e,r){var t=[],n=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return t}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}const nub=e=>Array.from(new Set(e)),each=(e,r)=>{if(isArray(e)){let t=0;const n=e.length;for(;t<n;t++)r(e[t],t)}else Object.entries(e).map(e=>{let t=_slicedToArray(e,2),n=t[0],o=t[1];return r(n,o)});return e},clone=e=>{if(isElement(e))return e;if(isArray(e))return e.slice();if(isDate(e))return new e.constructor(Number(e));if(isMap(e))return new Map(e);if(isSet(e))return new Set(e);if(isSymbol(e))return Symbol.prototype.valueOf?Object(Symbol.prototype.valueOf.call(e)):{};if(isRegexp(e)){const r=new e.constructor(e.source,/\w+$/.exec(e));return r.lastIndex=e.lastIndex,r}return isError(e)?Object.create(e):isPlainObject(e)?Object.assign({},e):e},deepClone=e=>isPlainObject(e)?deepCloneObject(e):isArray(e)?deepCloneArray(e):clone(e),deepCloneObject=e=>{if(isPlainObject(e)){const r=new e.constructor;for(const t in e)r[t]=deepClone(e[t]);return r}return e},deepCloneArray=e=>{const r=new e.constructor(e.length);for(let 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(const t in r)e[t]=r[t]}),e};function deepMergeTwo(e,r){const t=isArray(r),n=isArray(e);return isUndefined(r)?e:t!==n?clone(r):t?clone(r):isPlainObject(e)&&isPlainObject(r)?(Object.keys(r).forEach(t=>{e[t]=deepMergeTwo(e[t],r[t])}),e):clone(r)}const deepMerge=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.filter(isObject).reduce(deepMergeTwo,{})},curry=function e(r){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(){const n=r.currylen||r.length;for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];const c=t.concat(i);return c.length>=n?r(...c):e(r,c)}},curryWith=function e(r,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];const c=i.findIndex(t);if(c>=0){const e=n.concat(...i.slice(0,c+1));return r(...e)}const l=n.concat(...i);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];const 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+=~~(1e6*Math.random())}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(let t=0;t<e.length;++t)if(e[t]!==r[t])return!1;return!0},objectEqual=(e,r)=>{const t=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(r);if(t.length!==n.length)return!1;for(let n=0;n<t.length;n++){const o=t[n];if(isArray(e[o])&&isArray(r[o])){if(!arrayEqual(e[o],r[o]))return!1}else if(isObject(e[o])&&isObject(r[o])){if(!objectEqual(e[o],r[o]))return!1}else if(e[o]!==r[o])return!1}return!0},arrayDiff=(e,r)=>e.filter(e=>r.indexOf(e)<0),arrayIntersect=(e,r)=>{let 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),`${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){let 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];const t=r.split("."),n=t.length;if(!n)return;let o=-1;for(;e&&++o<n;){let r=t[o];for(;"\\"===r[r.length-1];)r=`${r.slice(0,-1)}.${t[++o]}`;e=e[r]}return e};function throttle(e,r){var t=this;let n=!1;function o(){n=!1}return void 0!==r||null!==r?function(){const i=t;if(!n){n=!0;for(var a=arguments.length,c=new Array(a),l=0;l<a;l++)c[l]=arguments[l];e.apply(i,c),window.setTimeout(o,r)}}:function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];const c=t;n||(n=!0,window.requestAnimationFrame(()=>{e.apply(c,i),o()}))}}function debounce(e){var r=this;let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];const c=r;t&&(clearTimeout(t),t=null),t=setTimeout(()=>{e.apply(c,i)},n)}}function fromPairs(e){return e.reduce((e,r)=>{let t=_slicedToArray(r,2);return _objectSpread({},e,{[t[0]]:t[1]})},{})}const SvgElement=(e,r)=>{const t=document.createElementNS("http://www.w3.org/2000/svg",e);if(!r)return t;for(const e in r)Object.hasOwnProperty.call(r,e)&&t.setAttribute(e,r[e]);return t};function parseDataOptions(e){return Object.entries(e).reduce((e,r)=>{let t=_slicedToArray(r,2),n=t[0],o=t[1];try{return _objectSpread({},e,{[n]:JSON.parse(`{"data": ${o.replace(/'/g,'"')}}`).data})}catch(r){return _objectSpread({},e,{[n]:o})}},{})}export{nub,each,clone,deepClone,deepCloneObject,deepCloneArray,merge,deepMerge,curry,curryWith,compose,getUID,range,reflow,arrayEqual,objectEqual,arrayDiff,arrayIntersect,convertPercentageToFloat,convertFloatToPercentage,convertMatrixToArray,getTime,camelize,dasherize,getValueByPath,throttle,debounce,fromPairs,SvgElement,parseDataOptions}; |
/*! | ||
* @pluginjs/utils v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/utils v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
@@ -5,0 +5,0 @@ */ |
/*! | ||
* @pluginjs/utils v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/utils v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 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["@pluginjs/utils"]={},r["@pluginjs/is"])}(this,function(r,e){"use strict";function n(r,e,n){return e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function t(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},i=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),i.forEach(function(e){n(r,e,t[e])})}return r}function i(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var n=[],t=!0,i=!1,o=void 0;try{for(var u,a=r[Symbol.iterator]();!(t=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);t=!0);}catch(r){i=!0,o=r}finally{try{t||null==a.return||a.return()}finally{if(i)throw o}}return n}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(r){return function(r){if(Array.isArray(r)){for(var e=0,n=new Array(r.length);e<r.length;e++)n[e]=r[e];return n}}(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 u=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 n=new r.constructor(r.source,/\w+$/.exec(r));return n.lastIndex=r.lastIndex,n}return e.isError(r)?Object.create(r):e.isPlainObject(r)?Object.assign({},r):r},a=function(r){return e.isPlainObject(r)?c(r):e.isArray(r)?f(r):u(r)},c=function(r){if(e.isPlainObject(r)){var n=new r.constructor;for(var t in r)n[t]=a(r[t]);return n}return r},f=function(r){for(var e=new r.constructor(r.length),n=0;n<r.length;n++)e[n]=a(r[n]);return e};function l(r,n){var t=e.isArray(n),i=e.isArray(r);return e.isUndefined(n)?r:t!==i?u(n):t?u(n):e.isPlainObject(r)&&e.isPlainObject(n)?(Object.keys(n).forEach(function(e){r[e]=l(r[e],n[e])}),r):u(n)}var s=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 n=0;n<r.length;++n)if(r[n]!==e[n])return!1;return!0};r.nub=function(r){return Array.from(new Set(r))},r.each=function(r,n){if(e.isArray(r))for(var t=0,o=r.length;t<o;t++)n(r[t],t);else Object.entries(r).map(function(r){var e=i(r,2),t=e[0],o=e[1];return n(t,o)});return r},r.clone=u,r.deepClone=a,r.deepCloneObject=c,r.deepCloneArray=f,r.merge=function(r){for(var e=arguments.length,n=new Array(e>1?e-1:0),t=1;t<e;t++)n[t-1]=arguments[t];return n.forEach(function(e){for(var n in e)r[n]=e[n]}),r},r.deepMerge=function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return n.filter(e.isObject).reduce(l,{})},r.curry=function r(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(){for(var t=e.currylen||e.length,i=arguments.length,u=new Array(i),a=0;a<i;a++)u[a]=arguments[a];var c=n.concat(u);return c.length>=t?e.apply(void 0,o(c)):r(e,c)}},r.curryWith=function r(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return function(){for(var i=arguments.length,u=new Array(i),a=0;a<i;a++)u[a]=arguments[a];var c=u.findIndex(n);if(c>=0){var f=t.concat.apply(t,o(u.slice(0,c+1)));return e.apply(void 0,o(f))}var l=t.concat.apply(t,u);return r(e,n,l)}},r.compose=function(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];var t=function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return e.reduceRight(function(r,n,t){return Array.isArray(r)&&t===e.length-1?n.apply(void 0,o(r)):n(r)},n)};return t.currylen=e[e.curylen||e.length-1].length,t},r.getUID=function(r){do{r+=~~(1e6*Math.random())}while(document.getElementById(r));return r},r.range=function(r){return Array.from({length:r},function(r,e){return e})},r.reflow=function(r){return r.offsetHeight},r.arrayEqual=s,r.objectEqual=function r(n,t){var i=Object.getOwnPropertyNames(n),o=Object.getOwnPropertyNames(t);if(i.length!==o.length)return!1;for(var u=0;u<i.length;u++){var a=i[u];if(e.isArray(n[a])&&e.isArray(t[a])){if(!s(n[a],t[a]))return!1}else if(e.isObject(n[a])&&e.isObject(t[a])){if(!r(n[a],t[a]))return!1}else if(n[a]!==t[a])return!1}return!0},r.arrayDiff=function(r,e){return r.filter(function(r){return e.indexOf(r)<0})},r.arrayIntersect=function(r,e){var n;return e.length>r.length&&(n=e,e=r,r=n),r.filter(function(r){return-1!==e.indexOf(r)})},r.convertPercentageToFloat=function(r){return parseFloat(r.slice(0,-1)/100,10)},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.getTime=function(){return void 0!==window.performance&&window.performance.now?window.performance.now():Date.now()},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.dasherize=function(r){return r.replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase()},r.getValueByPath=function(r,e){if(Object(r)!==r||void 0===e)return r;if(e in r)return r[e];var n=e.split("."),t=n.length;if(t){for(var i=-1;r&&++i<t;){for(var o=n[i];"\\"===o[o.length-1];)o="".concat(o.slice(0,-1),".").concat(n[++i]);r=r[o]}return r}},r.throttle=function(r,e){var n=this,t=!1;function i(){t=!1}return void 0!==e||null!==e?function(){var o=n;if(!t){t=!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=n;t||(t=!0,window.requestAnimationFrame(function(){r.apply(a,o),i()}))}},r.debounce=function(r){var e,n=this,t=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=n;e&&(clearTimeout(e),e=null),e=setTimeout(function(){r.apply(a,o)},t)}},r.fromPairs=function(r){return r.reduce(function(r,e){var o=i(e,2);return t({},r,n({},o[0],o[1]))},{})},r.SvgElement=function(r,e){var n=document.createElementNS("http://www.w3.org/2000/svg",r);if(!e)return n;for(var t in e)Object.hasOwnProperty.call(e,t)&&n.setAttribute(t,e[t]);return n},r.parseDataOptions=function(r){return Object.entries(r).reduce(function(r,e){var o=i(e,2),u=o[0],a=o[1];try{return t({},r,n({},u,JSON.parse('{"data": '.concat(a.replace(/'/g,'"'),"}")).data))}catch(e){return t({},r,n({},u,a))}},{})},Object.defineProperty(r,"__esModule",{value:!0})}); |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"category": "utils", | ||
@@ -37,8 +37,8 @@ "main": "dist/utils.common.js", | ||
"dependencies": { | ||
"@pluginjs/is": "^0.7.4" | ||
"@pluginjs/is": "^0.7.5" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.1.5", | ||
"@babel/core": "^7.2.2", | ||
"@pluginjs/browserslist-config": "^1.2.2", | ||
"@pluginjs/cli": "^0.7.4", | ||
"@pluginjs/cli": "^0.7.5", | ||
"babel-jest": "*", | ||
@@ -69,3 +69,3 @@ "jest": "*", | ||
], | ||
"gitHead": "15dd296725c971ec08d33abd1c655b205a52ade6" | ||
"gitHead": "a5b515ae1dc38f5f84fb18c70c322d361050593c" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Updated@pluginjs/is@^0.7.5