Skip to content

Commit

Permalink
Ensuring ES5 tests return Booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
stucox committed Nov 27, 2013
1 parent 1fc6e04 commit 463c82e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions feature-detects/es5/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Check if browser implements ECMAScript 5 Array per specification.
*/
define(['Modernizr'], function (Modernizr) {
Modernizr.addTest('es5array', function () {
return Array.prototype &&
return !!(Array.prototype &&
Array.prototype.every &&
Array.prototype.filter &&
Array.prototype.forEach &&
Expand All @@ -28,6 +28,6 @@ define(['Modernizr'], function (Modernizr) {
Array.prototype.some &&
Array.prototype.reduce &&
Array.prototype.reduceRight &&
Array.isArray;
Array.isArray);
});
});
4 changes: 2 additions & 2 deletions feature-detects/es5/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ define(['Modernizr'], function (Modernizr) {
} catch (e) {
// no ISO date parsing yet
}
return Date.now &&
return !!(Date.now &&
Date.prototype &&
Date.prototype.toISOString &&
Date.prototype.toJSON &&
canParseISODate;
canParseISODate);
});
});
2 changes: 1 addition & 1 deletion feature-detects/es5/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Check if browser implements ECMAScript 5 Function per specification.
*/
define(['Modernizr'], function (Modernizr) {
Modernizr.addTest('es5function', function () {
return Function.prototype && Function.prototype.bind;
return !!(Function.prototype && Function.prototype.bind);
});
});
4 changes: 2 additions & 2 deletions feature-detects/es5/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Check if browser implements ECMAScript 5 Object per specification.
*/
define(['Modernizr'], function (Modernizr) {
Modernizr.addTest('es5object', function () {
return Object.keys &&
return !!(Object.keys &&
Object.create &&
Object.getPrototypeOf &&
Object.getOwnPropertyNames &&
Expand All @@ -30,6 +30,6 @@ define(['Modernizr'], function (Modernizr) {
Object.defineProperties &&
Object.seal &&
Object.freeze &&
Object.preventExtensions;
Object.preventExtensions);
});
});
2 changes: 1 addition & 1 deletion feature-detects/es5/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Check if browser implements ECMAScript 5 String per specification.
*/
define(['Modernizr'], function (Modernizr) {
Modernizr.addTest('es5string', function () {
return String.prototype && String.prototype.trim;
return !!(String.prototype && String.prototype.trim);
});
});

0 comments on commit 463c82e

Please sign in to comment.