remedial.js/tests/types.js

32 lines
821 B
JavaScript
Raw Normal View History

2010-11-30 08:59:29 +00:00
(function () {
require('../lib/remedial');
var n = null,
u;
if (
'object' === typeOf(Object.create([])) &&
'object' === typeOf(Object.create(function () {})) &&
'array' === typeOf([]) &&
'string' === typeOf('') &&
'regexp' === typeOf(/ /) &&
'number' === typeOf(0) &&
'function' === typeOf(function () {}) &&
'function' === typeOf((function () {
var a = function () {};
a.foo = 'bar';
return a;
}())) &&
'boolean' === typeOf(true) &&
'boolean' === typeOf(false) &&
'date' === typeOf(new Date()) &&
'undefined' === typeOf(u) &&
'undefined' === typeOf(undefined) &&
'null' === typeOf(n) &&
'object' === typeOf({})
) {
console.log('passed type detections')
} else {
console.log('failed type detections')
}
}());