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:
Sam 2018-11-28 10:03:54 +11:00
parent bdb1268528
commit 3cb88bc566
1 changed files with 32 additions and 25 deletions

View File

@ -4,21 +4,22 @@ if (!Object.entries) {
var ownProps = Object.keys(obj),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
while (i--)
resArray[i] = [ownProps[i], obj[ownProps[i]]];
while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]];
return resArray;
};
}
// 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
Object.defineProperty(Object, "assign", {
value: function assign(target) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
value: function assign(target) {
// .length of function is 2
"use strict";
if (target == null) {
// TypeError if undefined or null
throw new TypeError("Cannot convert undefined or null to object");
}
var to = Object(target);
@ -26,7 +27,8 @@ if (typeof Object.assign !== 'function') {
for (var index = 1; index < arguments.length; 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) {
// Avoid bugs when hasOwnProperty is shadowed
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
/* eslint-disable */
if (!Array.prototype.includes) {
Object.defineProperty(Array.prototype, 'includes', {
Object.defineProperty(Array.prototype, "includes", {
value: function(searchElement, fromIndex) {
if (this == null) {
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);
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
@ -97,24 +104,24 @@ if (!Array.prototype.includes) {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill
if (!String.prototype.includes) {
Object.defineProperty(String.prototype, 'includes', {
Object.defineProperty(String.prototype, "includes", {
value: function(search, start) {
if (typeof start !== 'number') {
start = 0
if (typeof start !== "number") {
start = 0;
}
if (start + search.length > this.length) {
return false
return false;
} else {
return this.indexOf(search, start) !== -1
return this.indexOf(search, start) !== -1;
}
}
})
});
}
// https://tc39.github.io/ecma262/#sec-array.prototype.find
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
Object.defineProperty(Array.prototype, "find", {
value: function(predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
@ -127,8 +134,8 @@ if (!Array.prototype.find) {
var len = o.length >>> 0;
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
if (typeof predicate !== "function") {
throw new TypeError("predicate must be a function");
}
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.