Skip to content

Commit 6947a46

Browse files
Merge pull request #72 from Constellation/new-string
Do not use String object for string functions
2 parents 539ab94 + 864f8e2 commit 6947a46

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

SunSpider/date-format-tofte.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Date.prototype.formatDate = function (input,time) {
5959

6060
d() {
6161
// Day of the month, 2 digits with leading zeros
62-
return new String(self.getDate()).length == 1?
62+
return String(self.getDate()).length == 1?
6363
"0"+self.getDate() : self.getDate();
6464
},
6565

@@ -86,25 +86,25 @@ Date.prototype.formatDate = function (input,time) {
8686
h() {
8787
// 12-hour format of an hour with leading zeros
8888
if (self.getHours() > 12) {
89-
var s = new String(self.getHours()-12);
89+
var s = String(self.getHours()-12);
9090
return s.length == 1?
9191
"0"+ (self.getHours()-12) : self.getHours()-12;
9292
} else {
93-
var s = new String(self.getHours());
93+
var s = String(self.getHours());
9494
return s.length == 1?
9595
"0"+self.getHours() : self.getHours();
9696
}
9797
},
9898

9999
H() {
100100
// 24-hour format of an hour with leading zeros
101-
return new String(self.getHours()).length == 1?
101+
return String(self.getHours()).length == 1?
102102
"0"+self.getHours() : self.getHours();
103103
},
104104

105105
i() {
106106
// Minutes with leading zeros
107-
return new String(self.getMinutes()).length == 1?
107+
return String(self.getMinutes()).length == 1?
108108
"0"+self.getMinutes() : self.getMinutes();
109109
},
110110

@@ -176,7 +176,7 @@ Date.prototype.formatDate = function (input,time) {
176176

177177
s() {
178178
// Seconds, with leading zeros
179-
return new String(self.getSeconds()).length == 1?
179+
return String(self.getSeconds()).length == 1?
180180
"0"+self.getSeconds() : self.getSeconds();
181181
},
182182

SunSpider/date-format-xparb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ String.escape = function(string) {
349349
}
350350

351351
String.leftPad = function (val, size, ch) {
352-
var result = new String(val);
352+
var result = String(val);
353353
if (ch == null) {
354354
ch = " ";
355355
}

worker/bomb-subtests/date-format-tofte.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Date.prototype.formatDate = function (input,time) {
6969

7070
function d() {
7171
// Day of the month, 2 digits with leading zeros
72-
return new String(self.getDate()).length == 1?
72+
return String(self.getDate()).length == 1?
7373
"0"+self.getDate() : self.getDate();
7474
}
7575
function D() {
@@ -91,23 +91,23 @@ Date.prototype.formatDate = function (input,time) {
9191
function h() {
9292
// 12-hour format of an hour with leading zeros
9393
if (self.getHours() > 12) {
94-
var s = new String(self.getHours()-12);
94+
var s = String(self.getHours()-12);
9595
return s.length == 1?
9696
"0"+ (self.getHours()-12) : self.getHours()-12;
9797
} else {
98-
var s = new String(self.getHours());
98+
var s = String(self.getHours());
9999
return s.length == 1?
100100
"0"+self.getHours() : self.getHours();
101101
}
102102
}
103103
function H() {
104104
// 24-hour format of an hour with leading zeros
105-
return new String(self.getHours()).length == 1?
105+
return String(self.getHours()).length == 1?
106106
"0"+self.getHours() : self.getHours();
107107
}
108108
function i() {
109109
// Minutes with leading zeros
110-
return new String(self.getMinutes()).length == 1?
110+
return String(self.getMinutes()).length == 1?
111111
"0"+self.getMinutes() : self.getMinutes();
112112
}
113113
function j() {
@@ -169,7 +169,7 @@ Date.prototype.formatDate = function (input,time) {
169169
}
170170
function s() {
171171
// Seconds, with leading zeros
172-
return new String(self.getSeconds()).length == 1?
172+
return String(self.getSeconds()).length == 1?
173173
"0"+self.getSeconds() : self.getSeconds();
174174
}
175175
function t() {

worker/bomb-subtests/date-format-xparb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ String.escape = function(string) {
349349
}
350350

351351
String.leftPad = function (val, size, ch) {
352-
var result = new String(val);
352+
var result = String(val);
353353
if (ch == null) {
354354
ch = " ";
355355
}

0 commit comments

Comments
 (0)