Fix jshint issues in src/utils

This commit is contained in:
Christian Wesselhoeft 2014-03-22 23:31:51 -07:00
parent 1c286c1ae5
commit 35c24f4ec3

View file

@ -99,17 +99,17 @@ Phaser.Utils = {
switch (dir) switch (dir)
{ {
case 1: case 1:
str = Array(len + 1 - str.length).join(pad) + str; str = new Array(len + 1 - str.length).join(pad) + str;
break; break;
case 3: case 3:
var right = Math.ceil((padlen = len - str.length) / 2); var right = Math.ceil((padlen = len - str.length) / 2);
var left = padlen - right; var left = padlen - right;
str = Array(left+1).join(pad) + str + Array(right+1).join(pad); str = new Array(left+1).join(pad) + str + new Array(right+1).join(pad);
break; break;
default: default:
str = str + Array(len + 1 - str.length).join(pad); str = str + new Array(len + 1 - str.length).join(pad);
break; break;
} }
} }
@ -140,7 +140,7 @@ Phaser.Utils = {
// the "constructor" property of certain host objects, ie. |window.location| // the "constructor" property of certain host objects, ie. |window.location|
// https://bugzilla.mozilla.org/show_bug.cgi?id=814622 // https://bugzilla.mozilla.org/show_bug.cgi?id=814622
try { try {
if (obj.constructor && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf"))
{ {
return false; return false;
} }
@ -245,6 +245,7 @@ Phaser.Utils = {
*/ */
if (typeof Function.prototype.bind != 'function') { if (typeof Function.prototype.bind != 'function') {
/* jshint freeze: false */
Function.prototype.bind = (function () { Function.prototype.bind = (function () {
var slice = Array.prototype.slice; var slice = Array.prototype.slice;
@ -264,7 +265,10 @@ if (typeof Function.prototype.bind != 'function') {
} }
bound.prototype = (function F(proto) { bound.prototype = (function F(proto) {
proto && (F.prototype = proto); if (proto)
{
F.prototype = proto;
}
if (!(this instanceof F)) if (!(this instanceof F))
{ {
@ -285,5 +289,5 @@ if (!Array.isArray)
Array.isArray = function (arg) Array.isArray = function (arg)
{ {
return Object.prototype.toString.call(arg) == '[object Array]'; return Object.prototype.toString.call(arg) == '[object Array]';
} };
} }