DEV: Run file through prettier
We only alert on .js.es6 this is a js file so it is bypassed
This commit is contained in:
parent
bdb1268528
commit
3cb88bc566
|
@ -1,24 +1,25 @@
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
|
||||||
if (!Object.entries) {
|
if (!Object.entries) {
|
||||||
Object.entries = function( obj ){
|
Object.entries = function(obj) {
|
||||||
var ownProps = Object.keys( obj ),
|
var ownProps = Object.keys(obj),
|
||||||
i = ownProps.length,
|
i = ownProps.length,
|
||||||
resArray = new Array(i); // preallocate the Array
|
resArray = new Array(i); // preallocate the Array
|
||||||
while (i--)
|
while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]];
|
||||||
resArray[i] = [ownProps[i], obj[ownProps[i]]];
|
|
||||||
|
|
||||||
return resArray;
|
return resArray;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
||||||
if (typeof Object.assign !== 'function') {
|
if (typeof Object.assign !== "function") {
|
||||||
// Must be writable: true, enumerable: false, configurable: true
|
// Must be writable: true, enumerable: false, configurable: true
|
||||||
Object.defineProperty(Object, "assign", {
|
Object.defineProperty(Object, "assign", {
|
||||||
value: function assign(target) { // .length of function is 2
|
value: function assign(target) {
|
||||||
'use strict';
|
// .length of function is 2
|
||||||
if (target == null) { // TypeError if undefined or null
|
"use strict";
|
||||||
throw new TypeError('Cannot convert undefined or null to object');
|
if (target == null) {
|
||||||
|
// TypeError if undefined or null
|
||||||
|
throw new TypeError("Cannot convert undefined or null to object");
|
||||||
}
|
}
|
||||||
|
|
||||||
var to = Object(target);
|
var to = Object(target);
|
||||||
|
@ -26,7 +27,8 @@ if (typeof Object.assign !== 'function') {
|
||||||
for (var index = 1; index < arguments.length; index++) {
|
for (var index = 1; index < arguments.length; index++) {
|
||||||
var nextSource = arguments[index];
|
var nextSource = arguments[index];
|
||||||
|
|
||||||
if (nextSource != null) { // Skip over if undefined or null
|
if (nextSource != null) {
|
||||||
|
// Skip over if undefined or null
|
||||||
for (var nextKey in nextSource) {
|
for (var nextKey in nextSource) {
|
||||||
// Avoid bugs when hasOwnProperty is shadowed
|
// Avoid bugs when hasOwnProperty is shadowed
|
||||||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
||||||
|
@ -45,9 +47,8 @@ if (typeof Object.assign !== 'function') {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#Polyfill
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#Polyfill
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
if (!Array.prototype.includes) {
|
if (!Array.prototype.includes) {
|
||||||
Object.defineProperty(Array.prototype, 'includes', {
|
Object.defineProperty(Array.prototype, "includes", {
|
||||||
value: function(searchElement, fromIndex) {
|
value: function(searchElement, fromIndex) {
|
||||||
|
|
||||||
if (this == null) {
|
if (this == null) {
|
||||||
throw new TypeError('"this" is null or not defined');
|
throw new TypeError('"this" is null or not defined');
|
||||||
}
|
}
|
||||||
|
@ -75,7 +76,13 @@ if (!Array.prototype.includes) {
|
||||||
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
|
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
|
||||||
|
|
||||||
function sameValueZero(x, y) {
|
function sameValueZero(x, y) {
|
||||||
return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
|
return (
|
||||||
|
x === y ||
|
||||||
|
(typeof x === "number" &&
|
||||||
|
typeof y === "number" &&
|
||||||
|
isNaN(x) &&
|
||||||
|
isNaN(y))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7. Repeat, while k < len
|
// 7. Repeat, while k < len
|
||||||
|
@ -97,26 +104,26 @@ if (!Array.prototype.includes) {
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill
|
||||||
if (!String.prototype.includes) {
|
if (!String.prototype.includes) {
|
||||||
Object.defineProperty(String.prototype, 'includes', {
|
Object.defineProperty(String.prototype, "includes", {
|
||||||
value: function(search, start) {
|
value: function(search, start) {
|
||||||
if (typeof start !== 'number') {
|
if (typeof start !== "number") {
|
||||||
start = 0
|
start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start + search.length > this.length) {
|
if (start + search.length > this.length) {
|
||||||
return false
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return this.indexOf(search, start) !== -1
|
return this.indexOf(search, start) !== -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://tc39.github.io/ecma262/#sec-array.prototype.find
|
// https://tc39.github.io/ecma262/#sec-array.prototype.find
|
||||||
if (!Array.prototype.find) {
|
if (!Array.prototype.find) {
|
||||||
Object.defineProperty(Array.prototype, 'find', {
|
Object.defineProperty(Array.prototype, "find", {
|
||||||
value: function(predicate) {
|
value: function(predicate) {
|
||||||
// 1. Let O be ? ToObject(this value).
|
// 1. Let O be ? ToObject(this value).
|
||||||
if (this == null) {
|
if (this == null) {
|
||||||
throw new TypeError('"this" is null or not defined');
|
throw new TypeError('"this" is null or not defined');
|
||||||
}
|
}
|
||||||
|
@ -127,8 +134,8 @@ if (!Array.prototype.find) {
|
||||||
var len = o.length >>> 0;
|
var len = o.length >>> 0;
|
||||||
|
|
||||||
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
|
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
|
||||||
if (typeof predicate !== 'function') {
|
if (typeof predicate !== "function") {
|
||||||
throw new TypeError('predicate must be a function');
|
throw new TypeError("predicate must be a function");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||||
|
|
Loading…
Reference in New Issue