@flekschas/utils
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -0,1 +1,6 @@ | ||
## v0.3.0 | ||
- Changed the signature of `interpulateNumber` and `interpulateNumber` from `*(a, b)(p)` to `*(a, b, p)` | ||
- Added tests for animation utils | ||
## v0.2.1 | ||
@@ -2,0 +7,0 @@ |
@@ -1,5 +0,11 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
* Cubic in and out easing function | ||
* @param {number} t - The input time to be eased. Must be in [0, 1] where `0` | ||
* refers to the start and `1` to the end | ||
* @return {number} The eased time | ||
*/ | ||
const cubicInOut = t => { | ||
// eslint-disable-next-line no-param-reassign | ||
t *= 2; | ||
t = Math.min(1, Math.max(0, t)) * 2; | ||
// eslint-disable-next-line | ||
@@ -9,7 +15,27 @@ return (t <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; | ||
const interpolateNumber = (a, b) => p => a * (1 - p) + b * p; | ||
/** | ||
* Linearly interpolate two numbers | ||
* @param {number} a - The start value | ||
* @param {number} b - The end value | ||
* @param {number} p - The interpolation progress. Must be in [0, 1] where `0` | ||
* refers to the start value and `1` to the end value | ||
* @return {number} The interpolated number | ||
*/ | ||
const interpolateNumber = (a, b, p) => { | ||
// eslint-disable-next-line no-param-reassign | ||
p = Math.min(1, Math.max(0, p)); | ||
return a * (1 - p) + b * p; | ||
}; | ||
const interpolateVector = (a, b) => p => | ||
a.map((x, i) => interpolateNumber(x, b[i])(p)); | ||
/** | ||
* Lineraly interpolate a numerical vector | ||
* @param {array} a - The start vector | ||
* @param {array} b - The end vector | ||
* @param {number} p - The interpolation progress. Must be in [0, 1] where `0` | ||
* refers to the start vector and `1` to the end vector | ||
* @return {array} The interpolated vector | ||
*/ | ||
const interpolateVector = (a, b, p) => | ||
a.map((x, i) => interpolateNumber(x, b[i], p)); | ||
export { cubicInOut, interpolateNumber, interpolateVector }; |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
const isHexStr = str => str[0] === '#'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
@@ -3,0 +3,0 @@ * Store the values of an iterator in an array. |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
const XMLNS = 'http://www.w3.org/2000/svg'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
@@ -3,0 +3,0 @@ * Clone an event by invoking the source event's constructor and passing in |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
@@ -3,0 +3,0 @@ * Identity function |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
@@ -3,0 +3,0 @@ * L2 distance between a pair of 2D points |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
const mergeMaps = (map1, map2) => | ||
@@ -3,0 +3,0 @@ new Map( |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
@@ -3,0 +3,0 @@ * Identity function |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
const assign = (target, ...sources) => { | ||
@@ -3,0 +3,0 @@ sources.forEach(source => { |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
@@ -3,0 +3,0 @@ * Create a worker from a function |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
const sortAsc = (a, b) => a - b; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
const camelToConst = str => | ||
@@ -3,0 +3,0 @@ str |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
@@ -3,0 +3,0 @@ * Debounce a function call. |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
@@ -3,0 +3,0 @@ * Test if an object is a function |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
const lDist = l => (v, w) => | ||
@@ -3,0 +3,0 @@ v.length === w.length |
{ | ||
"name": "@flekschas/utils", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "A set of utility functions I use across projects", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -8,19 +8,41 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
/** | ||
* Cubic in and out easing function | ||
* @param {number} t - The input time to be eased. Must be in [0, 1] where `0` | ||
* refers to the start and `1` to the end | ||
* @return {number} The eased time | ||
*/ | ||
var cubicInOut = function cubicInOut(t) { | ||
// eslint-disable-next-line no-param-reassign | ||
t *= 2; // eslint-disable-next-line | ||
t = Math.min(1, Math.max(0, t)) * 2; // eslint-disable-next-line | ||
return (t <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; | ||
}; | ||
var interpolateNumber = function interpolateNumber(a, b) { | ||
return function (p) { | ||
return a * (1 - p) + b * p; | ||
}; | ||
/** | ||
* Linearly interpolate two numbers | ||
* @param {number} a - The start value | ||
* @param {number} b - The end value | ||
* @param {number} p - The interpolation progress. Must be in [0, 1] where `0` | ||
* refers to the start value and `1` to the end value | ||
* @return {number} The interpolated number | ||
*/ | ||
var interpolateNumber = function interpolateNumber(a, b, p) { | ||
// eslint-disable-next-line no-param-reassign | ||
p = Math.min(1, Math.max(0, p)); | ||
return a * (1 - p) + b * p; | ||
}; | ||
var interpolateVector = function interpolateVector(a, b) { | ||
return function (p) { | ||
return a.map(function (x, i) { | ||
return interpolateNumber(x, b[i])(p); | ||
}); | ||
}; | ||
/** | ||
* Lineraly interpolate a numerical vector | ||
* @param {array} a - The start vector | ||
* @param {array} b - The end vector | ||
* @param {number} p - The interpolation progress. Must be in [0, 1] where `0` | ||
* refers to the start vector and `1` to the end vector | ||
* @return {array} The interpolated vector | ||
*/ | ||
var interpolateVector = function interpolateVector(a, b, p) { | ||
return a.map(function (x, i) { | ||
return interpolateNumber(x, b[i], p); | ||
}); | ||
}; | ||
@@ -27,0 +49,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).utils=e.utils||{})}(this,(function(e){"use strict";var t=function(e,t){return function(n){return e*(1-n)+t*n}};e.cubicInOut=function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2},e.interpolateNumber=t,e.interpolateVector=function(e,n){return function(u){return e.map((function(e,r){return t(e,n[r])(u)}))}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).utils=e.utils||{})}(this,(function(e){"use strict";var t=function(e,t,n){return e*(1-(n=Math.min(1,Math.max(0,n))))+t*n};e.cubicInOut=function(e){return((e=2*Math.min(1,Math.max(0,e)))<=1?e*e*e:(e-=2)*e*e+2)/2},e.interpolateNumber=t,e.interpolateVector=function(e,n,i){return e.map((function(e,u){return t(e,n[u],i)}))},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,5 +0,11 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
/** | ||
* Cubic in and out easing function | ||
* @param {number} t - The input time to be eased. Must be in [0, 1] where `0` | ||
* refers to the start and `1` to the end | ||
* @return {number} The eased time | ||
*/ | ||
const cubicInOut = t => { | ||
// eslint-disable-next-line no-param-reassign | ||
t *= 2; | ||
t = Math.min(1, Math.max(0, t)) * 2; | ||
// eslint-disable-next-line | ||
@@ -9,6 +15,26 @@ return (t <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; | ||
const interpolateNumber = (a, b) => p => a * (1 - p) + b * p; | ||
/** | ||
* Linearly interpolate two numbers | ||
* @param {number} a - The start value | ||
* @param {number} b - The end value | ||
* @param {number} p - The interpolation progress. Must be in [0, 1] where `0` | ||
* refers to the start value and `1` to the end value | ||
* @return {number} The interpolated number | ||
*/ | ||
const interpolateNumber = (a, b, p) => { | ||
// eslint-disable-next-line no-param-reassign | ||
p = Math.min(1, Math.max(0, p)); | ||
return a * (1 - p) + b * p; | ||
}; | ||
const interpolateVector = (a, b) => p => | ||
a.map((x, i) => interpolateNumber(x, b[i])(p)); | ||
/** | ||
* Lineraly interpolate a numerical vector | ||
* @param {array} a - The start vector | ||
* @param {array} b - The end vector | ||
* @param {number} p - The interpolation progress. Must be in [0, 1] where `0` | ||
* refers to the start vector and `1` to the end vector | ||
* @return {array} The interpolated vector | ||
*/ | ||
const interpolateVector = (a, b, p) => | ||
a.map((x, i) => interpolateNumber(x, b[i], p)); | ||
@@ -823,4 +849,4 @@ const isHexStr = str => str[0] === '#'; | ||
var version = "0.2.1"; | ||
var version = "0.3.0"; | ||
export { addClass, argSort, assign, camelToConst, capitalize, cloneEvent, createWorker, cubicInOut, debounce, deepClone, dist, extend, forEach, forwardEvent, hasClass, hexStrToDec, identity, interpolateNumber, interpolateVector, isFunction, isHexStr, isParentOf, isPointHalfwayInRect, isPointInPolygon, isPointInRect, isRgbStr, isRgbaStr, iteratorToArray, l1Dist, l2Dist, l2Norm, lDist, map, mapFilter, max, mean, mergeMaps, min, mod, normalize, pipe, range, removeClass, rgbStrToDec, rgbToHex, some, sortAsc, sortDesc, sortPos, sum, throttle, throttleAndDebounce, toVoid, update, version, wait, withConstructor, withProperty, withReadOnlyProperty }; |
48
utils.js
@@ -1,2 +0,2 @@ | ||
// @flekschas/utils v0.2.1 Copyright 2020 Fritz Lekschas | ||
// @flekschas/utils v0.3.0 Copyright 2020 Fritz Lekschas | ||
(function (global, factory) { | ||
@@ -8,19 +8,41 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
/** | ||
* Cubic in and out easing function | ||
* @param {number} t - The input time to be eased. Must be in [0, 1] where `0` | ||
* refers to the start and `1` to the end | ||
* @return {number} The eased time | ||
*/ | ||
var cubicInOut = function cubicInOut(t) { | ||
// eslint-disable-next-line no-param-reassign | ||
t *= 2; // eslint-disable-next-line | ||
t = Math.min(1, Math.max(0, t)) * 2; // eslint-disable-next-line | ||
return (t <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; | ||
}; | ||
var interpolateNumber = function interpolateNumber(a, b) { | ||
return function (p) { | ||
return a * (1 - p) + b * p; | ||
}; | ||
/** | ||
* Linearly interpolate two numbers | ||
* @param {number} a - The start value | ||
* @param {number} b - The end value | ||
* @param {number} p - The interpolation progress. Must be in [0, 1] where `0` | ||
* refers to the start value and `1` to the end value | ||
* @return {number} The interpolated number | ||
*/ | ||
var interpolateNumber = function interpolateNumber(a, b, p) { | ||
// eslint-disable-next-line no-param-reassign | ||
p = Math.min(1, Math.max(0, p)); | ||
return a * (1 - p) + b * p; | ||
}; | ||
var interpolateVector = function interpolateVector(a, b) { | ||
return function (p) { | ||
return a.map(function (x, i) { | ||
return interpolateNumber(x, b[i])(p); | ||
}); | ||
}; | ||
/** | ||
* Lineraly interpolate a numerical vector | ||
* @param {array} a - The start vector | ||
* @param {array} b - The end vector | ||
* @param {number} p - The interpolation progress. Must be in [0, 1] where `0` | ||
* refers to the start vector and `1` to the end vector | ||
* @return {array} The interpolated vector | ||
*/ | ||
var interpolateVector = function interpolateVector(a, b, p) { | ||
return a.map(function (x, i) { | ||
return interpolateNumber(x, b[i], p); | ||
}); | ||
}; | ||
@@ -1080,3 +1102,3 @@ | ||
var version = "0.2.1"; | ||
var version = "0.3.0"; | ||
@@ -1083,0 +1105,0 @@ exports.addClass = addClass; |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).utils={})}(this,(function(t){"use strict";var n=function(t,n){return function(r){return t*(1-r)+n*r}},r="http://www.w3.org/2000/svg",e=function(t,n){if(t.namespaceURI===r){var e=t.getAttribute("class");return e&&!!e.match(new RegExp("(\\s|^)".concat(n,"(\\s|$)")))}return t.classList?t.classList.contains(n):!!t.className.match(new RegExp("(\\s|^)".concat(n,"(\\s|$)")))},o=function(t){var n=new t.constructor(t.type,t);return n.sourceUid=t.sourceUid,n.forwarded=t.forwarded,n};function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){for(var r in n){(u=n[r]).configurable=u.enumerable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(t,r,u)}if(Object.getOwnPropertySymbols)for(var e=Object.getOwnPropertySymbols(n),o=0;o<e.length;o++){var u,c=e[o];(u=n[c]).configurable=u.enumerable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(t,c,u)}return t}function i(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function a(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var r=[],e=!0,o=!1,u=void 0;try{for(var c,i=t[Symbol.iterator]();!(e=(c=i.next()).done)&&(r.push(c.value),!n||r.length!==n);e=!0);}catch(t){o=!0,u=t}finally{try{e||null==i.return||i.return()}finally{if(o)throw u}}return r}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var f=function(t){return t},s=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];return r.forEach((function(n){var r=Object.keys(n).reduce((function(t,r){return t[r]=Object.getOwnPropertyDescriptor(n,r),t}),{});Object.getOwnPropertySymbols(n).forEach((function(t){var e=Object.getOwnPropertyDescriptor(n,t);e.enumerable&&(r[t]=e)})),Object.defineProperties(t,r)})),t},l=function t(n,r){if(null===r||"object"!==u(r))return r;if(r.constructor!==Object&&r.constructor!==Array)return r;if(r.constructor===Date||r.constructor===RegExp||r.constructor===Function||r.constructor===String||r.constructor===Number||r.constructor===Boolean)return new r.constructor(r);var e=n||new r.constructor;return Object.keys(r).forEach((function(n){e[n]=void 0===e[n]?t(void 0,r[n]):e[n]})),e},p=function(t){return"".concat(t[0].toUpperCase()).concat(t.substr(1))},d=function(t,n){return t-n},v=function(t){return Math.sqrt(t.reduce((function(t,n){return t+Math.pow(n,2)}),0))},y=function(t){return t.reduce((function(t,n){return t+n}),0)};t.addClass=function(t,n){if(t.namespaceURI===r){if(!e(t,n)){var o=t.getAttribute("class")||"";t.setAttribute("class","".concat(o," ").concat(n))}}else t.classList?t.classList.add(n):e(t,n)||(t.className+=" ".concat(n))},t.argSort=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.comparator,e=void 0===r?d:r,o=n.ignoreNull,u=void 0!==o&&o;return t.map(u?function(t,n){return null===t?void 0:[t,n]}:function(t,n){return[t,n]}).sort((function(t,n){return e(t[0],n[0])})).reduce((function(t,n){return n?(t.push(n[1]),t):t}),[])},t.assign=s,t.camelToConst=function(t){return t.split(/(?=[A-Z])/).join("_").toUpperCase()},t.capitalize=p,t.cloneEvent=o,t.createWorker=function(t){return new Worker(window.URL.createObjectURL(new Blob(["(".concat(t.toString(),")()")],{type:"text/javascript"})))},t.cubicInOut=function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2},t.debounce=function(t,n){var r,e=function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];var c=function(){r=null,t.apply(void 0,o)};clearTimeout(r),r=setTimeout(c,n)};return e.cancel=function(){clearTimeout(r)},e.now=function(){return t.apply(void 0,arguments)},e},t.deepClone=function(t){return l(void 0,t)},t.dist=function(t,n,r,e){return Math.sqrt(Math.pow(t-r,2)+Math.pow(n-e,2))},t.extend=l,t.forEach=function(t){return function(n){return Array.prototype.forEach.call(n,t)}},t.forwardEvent=function(t,n){n.dispatchEvent(o(t))},t.hasClass=e,t.hexStrToDec=function(t){return parseInt(t.substr(1),16)},t.identity=f,t.interpolateNumber=n,t.interpolateVector=function(t,r){return function(e){return t.map((function(t,o){return n(t,r[o])(e)}))}},t.isFunction=function(t){return!!(t&&t.constructor&&t.call&&t.apply)},t.isHexStr=function(t){return"#"===t[0]},t.isParentOf=function(t,n){for(var r=t;r&&r!==n&&"HTML"!==r.tagName;)r=r.parentNode;return r===n},t.isPointHalfwayInRect=function(t,n){var r=a(t,2),e=r[0],o=r[1],u=a(n,4),c=u[0],i=u[1],f=u[2],s=u[3];return e>=c&&e<=i||o>=f&&o<=s},t.isPointInPolygon=function(){for(var t,n,r,e,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],u=a(o,2),c=u[0],i=u[1],f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=!1,l=0,p=f.length-2;l<f.length;l+=2)t=f[l],n=f[l+1],r=f[p],n>i!=(e=f[p+1])>i&&c<(r-t)*(i-n)/(e-n)+t&&(s=!s),p=l;return s},t.isPointInRect=function(t,n){var r=a(t,2),e=r[0],o=r[1],u=a(n,4),c=u[0],i=u[1],f=u[2],s=u[3];return e>=c&&e<=i&&o>=f&&o<=s},t.isRgbStr=function(t){return"rgb("===t.substring(0,4)},t.isRgbaStr=function(t){return"rgba"===t.substring(0,4)},t.iteratorToArray=function(t){var n=[],r=!0,e=!1,o=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done);r=!0){var i=u.value;n.push(i)}}catch(t){e=!0,o=t}finally{try{r||null==c.return||c.return()}finally{if(e)throw o}}return n},t.l1Dist=function(t,n){return t.length===n.length?t.reduce((function(t,r,e){return t+Math.abs(r-n[e])}),0):void 0},t.l2Dist=function(t,n){return t.length===n.length?t.reduce((function(t,r,e){return t+Math.abs(r-n[e])}),0):void 0},t.l2Norm=v,t.lDist=function(t){return function(n,r){return n.length===r.length?Math.pow(n.reduce((function(n,e,o){return n+Math.pow(Math.abs(e-r[o]),t)}),0),1/t):void 0}},t.map=function(t){return function(n){return Array.prototype.map.call(n,t)}},t.mapFilter=function(t,n){return function(r){for(var e=[],o=0;o<r.length;o++){var u=t(r[o],o);n(u,e.length)&&e.push(u)}return e}},t.max=function(t){return t.reduce((function(t,n){return t>n?t:n}),-1/0)},t.mean=function(t){return y(t)/t.length},t.mergeMaps=function(t,n){return new Map(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.delegateYield(t,"t0",1);case 1:return r.delegateYield(n,"t1",2);case 2:case"end":return r.stop()}}),r)}))())},t.min=function(t){return t.reduce((function(t,n){return t<n?t:n}),1/0)},t.mod=function(t,n){return(t%n+t)%n},t.normalize=function(t){var n=v(t);return t.map((function(t){return t/n}))},t.pipe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(function(t){return n.reduce((function(t,n){return n(t)}),t)})},t.range=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Array(Math.ceil((n-t)/r)).fill().map((function(n,e){return t+e*r}))},t.removeClass=function(t,n){var o=new RegExp("(\\s|^)".concat(n,"(\\s|$)"));if(t.namespaceURI===r){var u=t.getAttribute("class")||"";t.setAttribute("class",u.replace(o," "))}else t.classList?t.classList.remove(n):e(t,n)&&(t.className=t.className.replace(o," "))},t.rgbStrToDec=function(t){return t.match(/(\d+),\s*(\d+),\s*(\d+),?\s*([\d.]+)?/).slice(1,4).map((function(t,n){return+t<<8*(2-n)})).reduce((function(t,n){return n+t}),0)},t.rgbToHex=function(t,n,r){var e=function(t){var n=t.toString(16);return 1===n.length?"0".concat(n):n};return"#".concat(e(t)).concat(e(n)).concat(e(r))},t.some=function(t){return function(n){return Array.prototype.some.call(n,t)}},t.sortAsc=d,t.sortDesc=function(t,n){return n-t},t.sortPos=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.comparator,e=void 0===r?d:r,o=n.ignoreNull,u=void 0!==o&&o;return t.map(u?function(t,n){return null===t?void 0:[t,n]}:function(t,n){return[t,n]}).sort((function(t,n){return e(t[0],n[0])})).reduce((function(t,n,r){return n?(t[n[1]]=r,t):t}),[])},t.sum=y,t.throttle=function(t,n){var r=!1,e=function(){r||(t.apply(void 0,arguments),r=!0,setTimeout((function(){r=!1}),n))};return e.reset=function(){r=!1},e.now=function(){return t.apply(void 0,arguments)},e},t.throttleAndDebounce=function(t,n){var r,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=0;e=null===e?n:e;var u=function(){for(var n=arguments.length,u=new Array(n),c=0;c<n;c++)u[c]=arguments[c];var i=function(){o>0&&(t.apply(void 0,u),o=0)};clearTimeout(r),r=setTimeout(i,e)},c=!1,i=function(){c?(o++,u.apply(void 0,arguments)):(t.apply(void 0,arguments),u.apply(void 0,arguments),c=!0,o=0,setTimeout((function(){c=!1}),n))};return i.reset=function(){c=!1},i.cancel=function(){clearTimeout(r)},i.now=function(){return t.apply(void 0,arguments)},i},t.toVoid=function(){},t.update=function t(n,r){if(null===r||"object"!==u(r))return r;if(r.constructor!==Object&&r.constructor!==Array)return new r.constructor(r);var e=new n.constructor,o=!1;return Object.keys(r).forEach((function(u){e[u]=t(n[u],r[u]),o=o||e[u]!==n[u]})),(o=o||Object.keys(n).filter((function(t){return void 0===r[t]})).length)?e:n},t.version="0.2.1",t.wait=function(t){return new Promise((function(n){return setTimeout(n,t)}))},t.withConstructor=function(t){return function(n){return s(n,{__proto__:{constructor:t}})}},t.withProperty=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.initialValue,e=void 0===r?void 0:r,o=n.getter,u=n.setter,a=n.cloner,l=void 0===a?f:a,d=n.transformer,v=void 0===d?f:d,y=n.validator,m=void 0===y?function(){return!0}:y;return function(n){var r,a,f=e,d=o?function(){return o()}:function(){return l(f)},y=u?function(t){return u(t)}:function(t){var n=v(t);f=m(n)?n:f};return s(n,(r={},(a={})[t]=a[t]||{},a[t].get=function(){return d()},i(r,"set".concat(p(t)),(function(t){y(t)})),c(r,a),r))}},t.withReadOnlyProperty=function(t,n){return function(r){var e,o;return s(r,(e={},(o={})[t]=o[t]||{},o[t].get=function(){return n},c(e,o),e))}},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).utils={})}(this,(function(t){"use strict";var n=function(t,n,r){return t*(1-(r=Math.min(1,Math.max(0,r))))+n*r},r="http://www.w3.org/2000/svg",e=function(t,n){if(t.namespaceURI===r){var e=t.getAttribute("class");return e&&!!e.match(new RegExp("(\\s|^)".concat(n,"(\\s|$)")))}return t.classList?t.classList.contains(n):!!t.className.match(new RegExp("(\\s|^)".concat(n,"(\\s|$)")))},o=function(t){var n=new t.constructor(t.type,t);return n.sourceUid=t.sourceUid,n.forwarded=t.forwarded,n};function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){for(var r in n){(u=n[r]).configurable=u.enumerable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(t,r,u)}if(Object.getOwnPropertySymbols)for(var e=Object.getOwnPropertySymbols(n),o=0;o<e.length;o++){var u,c=e[o];(u=n[c]).configurable=u.enumerable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(t,c,u)}return t}function i(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function a(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var r=[],e=!0,o=!1,u=void 0;try{for(var c,i=t[Symbol.iterator]();!(e=(c=i.next()).done)&&(r.push(c.value),!n||r.length!==n);e=!0);}catch(t){o=!0,u=t}finally{try{e||null==i.return||i.return()}finally{if(o)throw u}}return r}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var f=function(t){return t},s=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];return r.forEach((function(n){var r=Object.keys(n).reduce((function(t,r){return t[r]=Object.getOwnPropertyDescriptor(n,r),t}),{});Object.getOwnPropertySymbols(n).forEach((function(t){var e=Object.getOwnPropertyDescriptor(n,t);e.enumerable&&(r[t]=e)})),Object.defineProperties(t,r)})),t},l=function t(n,r){if(null===r||"object"!==u(r))return r;if(r.constructor!==Object&&r.constructor!==Array)return r;if(r.constructor===Date||r.constructor===RegExp||r.constructor===Function||r.constructor===String||r.constructor===Number||r.constructor===Boolean)return new r.constructor(r);var e=n||new r.constructor;return Object.keys(r).forEach((function(n){e[n]=void 0===e[n]?t(void 0,r[n]):e[n]})),e},p=function(t){return"".concat(t[0].toUpperCase()).concat(t.substr(1))},d=function(t,n){return t-n},v=function(t){return Math.sqrt(t.reduce((function(t,n){return t+Math.pow(n,2)}),0))},y=function(t){return t.reduce((function(t,n){return t+n}),0)};t.addClass=function(t,n){if(t.namespaceURI===r){if(!e(t,n)){var o=t.getAttribute("class")||"";t.setAttribute("class","".concat(o," ").concat(n))}}else t.classList?t.classList.add(n):e(t,n)||(t.className+=" ".concat(n))},t.argSort=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.comparator,e=void 0===r?d:r,o=n.ignoreNull,u=void 0!==o&&o;return t.map(u?function(t,n){return null===t?void 0:[t,n]}:function(t,n){return[t,n]}).sort((function(t,n){return e(t[0],n[0])})).reduce((function(t,n){return n?(t.push(n[1]),t):t}),[])},t.assign=s,t.camelToConst=function(t){return t.split(/(?=[A-Z])/).join("_").toUpperCase()},t.capitalize=p,t.cloneEvent=o,t.createWorker=function(t){return new Worker(window.URL.createObjectURL(new Blob(["(".concat(t.toString(),")()")],{type:"text/javascript"})))},t.cubicInOut=function(t){return((t=2*Math.min(1,Math.max(0,t)))<=1?t*t*t:(t-=2)*t*t+2)/2},t.debounce=function(t,n){var r,e=function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];var c=function(){r=null,t.apply(void 0,o)};clearTimeout(r),r=setTimeout(c,n)};return e.cancel=function(){clearTimeout(r)},e.now=function(){return t.apply(void 0,arguments)},e},t.deepClone=function(t){return l(void 0,t)},t.dist=function(t,n,r,e){return Math.sqrt(Math.pow(t-r,2)+Math.pow(n-e,2))},t.extend=l,t.forEach=function(t){return function(n){return Array.prototype.forEach.call(n,t)}},t.forwardEvent=function(t,n){n.dispatchEvent(o(t))},t.hasClass=e,t.hexStrToDec=function(t){return parseInt(t.substr(1),16)},t.identity=f,t.interpolateNumber=n,t.interpolateVector=function(t,r,e){return t.map((function(t,o){return n(t,r[o],e)}))},t.isFunction=function(t){return!!(t&&t.constructor&&t.call&&t.apply)},t.isHexStr=function(t){return"#"===t[0]},t.isParentOf=function(t,n){for(var r=t;r&&r!==n&&"HTML"!==r.tagName;)r=r.parentNode;return r===n},t.isPointHalfwayInRect=function(t,n){var r=a(t,2),e=r[0],o=r[1],u=a(n,4),c=u[0],i=u[1],f=u[2],s=u[3];return e>=c&&e<=i||o>=f&&o<=s},t.isPointInPolygon=function(){for(var t,n,r,e,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],u=a(o,2),c=u[0],i=u[1],f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=!1,l=0,p=f.length-2;l<f.length;l+=2)t=f[l],n=f[l+1],r=f[p],n>i!=(e=f[p+1])>i&&c<(r-t)*(i-n)/(e-n)+t&&(s=!s),p=l;return s},t.isPointInRect=function(t,n){var r=a(t,2),e=r[0],o=r[1],u=a(n,4),c=u[0],i=u[1],f=u[2],s=u[3];return e>=c&&e<=i&&o>=f&&o<=s},t.isRgbStr=function(t){return"rgb("===t.substring(0,4)},t.isRgbaStr=function(t){return"rgba"===t.substring(0,4)},t.iteratorToArray=function(t){var n=[],r=!0,e=!1,o=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done);r=!0){var i=u.value;n.push(i)}}catch(t){e=!0,o=t}finally{try{r||null==c.return||c.return()}finally{if(e)throw o}}return n},t.l1Dist=function(t,n){return t.length===n.length?t.reduce((function(t,r,e){return t+Math.abs(r-n[e])}),0):void 0},t.l2Dist=function(t,n){return t.length===n.length?t.reduce((function(t,r,e){return t+Math.abs(r-n[e])}),0):void 0},t.l2Norm=v,t.lDist=function(t){return function(n,r){return n.length===r.length?Math.pow(n.reduce((function(n,e,o){return n+Math.pow(Math.abs(e-r[o]),t)}),0),1/t):void 0}},t.map=function(t){return function(n){return Array.prototype.map.call(n,t)}},t.mapFilter=function(t,n){return function(r){for(var e=[],o=0;o<r.length;o++){var u=t(r[o],o);n(u,e.length)&&e.push(u)}return e}},t.max=function(t){return t.reduce((function(t,n){return t>n?t:n}),-1/0)},t.mean=function(t){return y(t)/t.length},t.mergeMaps=function(t,n){return new Map(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.delegateYield(t,"t0",1);case 1:return r.delegateYield(n,"t1",2);case 2:case"end":return r.stop()}}),r)}))())},t.min=function(t){return t.reduce((function(t,n){return t<n?t:n}),1/0)},t.mod=function(t,n){return(t%n+t)%n},t.normalize=function(t){var n=v(t);return t.map((function(t){return t/n}))},t.pipe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(function(t){return n.reduce((function(t,n){return n(t)}),t)})},t.range=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Array(Math.ceil((n-t)/r)).fill().map((function(n,e){return t+e*r}))},t.removeClass=function(t,n){var o=new RegExp("(\\s|^)".concat(n,"(\\s|$)"));if(t.namespaceURI===r){var u=t.getAttribute("class")||"";t.setAttribute("class",u.replace(o," "))}else t.classList?t.classList.remove(n):e(t,n)&&(t.className=t.className.replace(o," "))},t.rgbStrToDec=function(t){return t.match(/(\d+),\s*(\d+),\s*(\d+),?\s*([\d.]+)?/).slice(1,4).map((function(t,n){return+t<<8*(2-n)})).reduce((function(t,n){return n+t}),0)},t.rgbToHex=function(t,n,r){var e=function(t){var n=t.toString(16);return 1===n.length?"0".concat(n):n};return"#".concat(e(t)).concat(e(n)).concat(e(r))},t.some=function(t){return function(n){return Array.prototype.some.call(n,t)}},t.sortAsc=d,t.sortDesc=function(t,n){return n-t},t.sortPos=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.comparator,e=void 0===r?d:r,o=n.ignoreNull,u=void 0!==o&&o;return t.map(u?function(t,n){return null===t?void 0:[t,n]}:function(t,n){return[t,n]}).sort((function(t,n){return e(t[0],n[0])})).reduce((function(t,n,r){return n?(t[n[1]]=r,t):t}),[])},t.sum=y,t.throttle=function(t,n){var r=!1,e=function(){r||(t.apply(void 0,arguments),r=!0,setTimeout((function(){r=!1}),n))};return e.reset=function(){r=!1},e.now=function(){return t.apply(void 0,arguments)},e},t.throttleAndDebounce=function(t,n){var r,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=0;e=null===e?n:e;var u=function(){for(var n=arguments.length,u=new Array(n),c=0;c<n;c++)u[c]=arguments[c];var i=function(){o>0&&(t.apply(void 0,u),o=0)};clearTimeout(r),r=setTimeout(i,e)},c=!1,i=function(){c?(o++,u.apply(void 0,arguments)):(t.apply(void 0,arguments),u.apply(void 0,arguments),c=!0,o=0,setTimeout((function(){c=!1}),n))};return i.reset=function(){c=!1},i.cancel=function(){clearTimeout(r)},i.now=function(){return t.apply(void 0,arguments)},i},t.toVoid=function(){},t.update=function t(n,r){if(null===r||"object"!==u(r))return r;if(r.constructor!==Object&&r.constructor!==Array)return new r.constructor(r);var e=new n.constructor,o=!1;return Object.keys(r).forEach((function(u){e[u]=t(n[u],r[u]),o=o||e[u]!==n[u]})),(o=o||Object.keys(n).filter((function(t){return void 0===r[t]})).length)?e:n},t.version="0.3.0",t.wait=function(t){return new Promise((function(n){return setTimeout(n,t)}))},t.withConstructor=function(t){return function(n){return s(n,{__proto__:{constructor:t}})}},t.withProperty=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.initialValue,e=void 0===r?void 0:r,o=n.getter,u=n.setter,a=n.cloner,l=void 0===a?f:a,d=n.transformer,v=void 0===d?f:d,y=n.validator,m=void 0===y?function(){return!0}:y;return function(n){var r,a,f=e,d=o?function(){return o()}:function(){return l(f)},y=u?function(t){return u(t)}:function(t){var n=v(t);f=m(n)?n:f};return s(n,(r={},(a={})[t]=a[t]||{},a[t].get=function(){return d()},i(r,"set".concat(p(t)),(function(t){y(t)})),c(r,a),r))}},t.withReadOnlyProperty=function(t,n){return function(r){var e,o;return s(r,(e={},(o={})[t]=o[t]||{},o[t].get=function(){return n},c(e,o),e))}},Object.defineProperty(t,"__esModule",{value:!0})})); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
161500
3884
0