7a782229dd
* updated SVGPathCommander to support a wider range of shapes, including closed/unclosed shapes * added d3-polygon dependency for ***svgMorph*** component * updated both ***svgMorph*** and ***svgCubicMorph*** components * updated polyfill * code cleanup * documentation updates
94 lines
2.7 KiB
JavaScript
94 lines
2.7 KiB
JavaScript
/*!
|
|
* KUTE.js Polyfill v2.0.14 (http://thednp.github.io/kute.js)
|
|
* Copyright 2015-2020 © thednp
|
|
* Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE)
|
|
*/
|
|
"use strict";
|
|
if (!Array.from) {
|
|
Array.from = (function () {
|
|
var toStr = Object.prototype.toString;
|
|
var isCallable = function (fn) {
|
|
return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
|
|
};
|
|
var toInteger = function (value) {
|
|
var number = Number(value);
|
|
if (isNaN(number)) { return 0; }
|
|
if (number === 0 || !isFinite(number)) { return number; }
|
|
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
|
|
};
|
|
var maxSafeInteger = Math.pow(2, 53) - 1;
|
|
var toLength = function (value) {
|
|
var len = toInteger(value);
|
|
return Math.min(Math.max(len, 0), maxSafeInteger);
|
|
};
|
|
return function from(arrayLike) {
|
|
var C = this, items = Object(arrayLike);
|
|
if (arrayLike == null) {
|
|
throw new TypeError('Array.from requires an array-like object - not null or undefined');
|
|
}
|
|
var mapFn = arguments.length > 1 ? arguments[1] : void undefined, T;
|
|
if (typeof mapFn !== 'undefined') {
|
|
if (!isCallable(mapFn)) {
|
|
throw new TypeError('Array.from: when provided, the second argument must be a function');
|
|
}
|
|
if (arguments.length > 2) {
|
|
T = arguments[2];
|
|
}
|
|
}
|
|
var len = toLength(items.length);
|
|
var A = isCallable(C) ? Object(new C(len)) : new Array(len);
|
|
var k = 0;
|
|
var kValue;
|
|
while (k < len) {
|
|
kValue = items[k];
|
|
if (mapFn) {
|
|
A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
|
|
} else {
|
|
A[k] = kValue;
|
|
}
|
|
k += 1;
|
|
}
|
|
A.length = len;
|
|
return A;
|
|
}
|
|
}());
|
|
}
|
|
|
|
if (!Array.prototype.includes) {
|
|
Array.prototype.includes = function(searchElement ) {
|
|
var O = Object(this);
|
|
var len = parseInt(O.length) || 0;
|
|
if (len === 0) {
|
|
return false;
|
|
}
|
|
var n = parseInt(arguments[1]) || 0;
|
|
var k;
|
|
if (n >= 0) {
|
|
k = n;
|
|
} else {
|
|
k = len + n;
|
|
if (k < 0) {k = 0;}
|
|
}
|
|
var currentElement;
|
|
while (k < len) {
|
|
currentElement = O[k];
|
|
if (searchElement === currentElement ||
|
|
(searchElement !== searchElement && currentElement !== currentElement)) {
|
|
return true;
|
|
}
|
|
k++;
|
|
}
|
|
return false;
|
|
};
|
|
}
|
|
|
|
if (!String.prototype.includes) {
|
|
String.prototype.includes = function(search, start) {
|
|
if (search instanceof RegExp) {
|
|
throw TypeError('first argument must not be a RegExp');
|
|
}
|
|
if (start === undefined) { start = 0; }
|
|
return this.indexOf(search, start) !== -1;
|
|
};
|
|
}
|