Skip to content

Commit 35c24f4

Browse files
author
Christian Wesselhoeft
committed
Fix jshint issues in src/utils
1 parent 1c286c1 commit 35c24f4

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/utils/Utils.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,17 @@ Phaser.Utils = {
9999
switch (dir)
100100
{
101101
case 1:
102-
str = Array(len + 1 - str.length).join(pad) + str;
102+
str = new Array(len + 1 - str.length).join(pad) + str;
103103
break;
104104

105105
case 3:
106106
var right = Math.ceil((padlen = len - str.length) / 2);
107107
var left = padlen - right;
108-
str = Array(left+1).join(pad) + str + Array(right+1).join(pad);
108+
str = new Array(left+1).join(pad) + str + new Array(right+1).join(pad);
109109
break;
110110

111111
default:
112-
str = str + Array(len + 1 - str.length).join(pad);
112+
str = str + new Array(len + 1 - str.length).join(pad);
113113
break;
114114
}
115115
}
@@ -140,7 +140,7 @@ Phaser.Utils = {
140140
// the "constructor" property of certain host objects, ie. |window.location|
141141
// https://bugzilla.mozilla.org/show_bug.cgi?id=814622
142142
try {
143-
if (obj.constructor && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf"))
143+
if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf"))
144144
{
145145
return false;
146146
}
@@ -245,6 +245,7 @@ Phaser.Utils = {
245245
*/
246246
if (typeof Function.prototype.bind != 'function') {
247247

248+
/* jshint freeze: false */
248249
Function.prototype.bind = (function () {
249250

250251
var slice = Array.prototype.slice;
@@ -264,7 +265,10 @@ if (typeof Function.prototype.bind != 'function') {
264265
}
265266

266267
bound.prototype = (function F(proto) {
267-
proto && (F.prototype = proto);
268+
if (proto)
269+
{
270+
F.prototype = proto;
271+
}
268272

269273
if (!(this instanceof F))
270274
{
@@ -285,5 +289,5 @@ if (!Array.isArray)
285289
Array.isArray = function (arg)
286290
{
287291
return Object.prototype.toString.call(arg) == '[object Array]';
288-
}
292+
};
289293
}

0 commit comments

Comments
 (0)