@shopgate/webpack 7.30.0-alpha.8 → 7.30.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/polyfill.js +0 -48
- package/package.json +1 -1
- package/webpack.config.js +1 -0
package/lib/polyfill.js
CHANGED
|
@@ -1,49 +1 @@
|
|
|
1
1
|
window.SGEvent = {}
|
|
2
|
-
|
|
3
|
-
// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
|
|
4
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd
|
|
5
|
-
if (!String.prototype.padEnd) {
|
|
6
|
-
String.prototype.padEnd = function padEnd(targetLength, padString) {
|
|
7
|
-
// Floor if number or convert non-number to 0
|
|
8
|
-
targetLength = targetLength >> 0
|
|
9
|
-
padString = String(padString || ' ')
|
|
10
|
-
if (this.length > targetLength) {
|
|
11
|
-
return String(this)
|
|
12
|
-
} else {
|
|
13
|
-
targetLength = targetLength - this.length
|
|
14
|
-
|
|
15
|
-
if (targetLength > padString.length) {
|
|
16
|
-
// Append to original to ensure we are longer than needed.
|
|
17
|
-
padString += padString.repeat(targetLength / padString.length)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return String(this) + padString.slice(0, targetLength)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!Array.prototype.flat) {
|
|
26
|
-
Array.prototype.flat = function(depth) {
|
|
27
|
-
var flattened = [];
|
|
28
|
-
|
|
29
|
-
function flatten(arr, currentDepth) {
|
|
30
|
-
for (var i = 0; i < arr.length; i++) {
|
|
31
|
-
if (Array.isArray(arr[i]) && currentDepth < depth) {
|
|
32
|
-
flatten(arr[i], currentDepth + 1);
|
|
33
|
-
} else {
|
|
34
|
-
flattened.push(arr[i]);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
flatten(this, 0);
|
|
40
|
-
|
|
41
|
-
return flattened;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!Array.prototype.flatMap) {
|
|
46
|
-
Array.prototype.flatMap = function(callback, thisArg) {
|
|
47
|
-
return this.map(callback, thisArg).flat();
|
|
48
|
-
};
|
|
49
|
-
}
|
package/package.json
CHANGED