Node.js examples for Data Type:Type Check
Context insensitive type checks
var toString = Object.prototype.toString; exports.isObject = function (arg) { return '[object Object]' == toString.call(arg) } exports.isArray = function (arg) { return Array.isArray(arg) || 'object' == typeof arg && '[object Array]' == toString.call(arg) } exports.isDate = function (arg) { return 'object' == typeof arg && '[object Date]' == toString.call(arg) } exports.isRegExp = function (arg) { return 'object' == typeof arg && '[object RegExp]' == toString.call(arg) }