Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Special case using the String constructor #4

Merged
merged 1 commit into from

2 participants

@matthewp

typeof new String("foo") === 'object'

This fixes #3

@matthewp matthewp Need to use toString check for strings.
typeof new String("foo") === 'object'
5d50c1d
@tj tj merged commit 1f1ea85 into from
@tj
Owner
tj commented

for parity we should add boolean as well, but that as well is terrible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 16, 2013
  1. @matthewp

    Need to use toString check for strings.

    matthewp authored
    typeof new String("foo") === 'object'
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  index.js
View
1  index.js
@@ -20,6 +20,7 @@ module.exports = function(val){
case '[object RegExp]': return 'regexp';
case '[object Arguments]': return 'arguments';
case '[object Array]': return 'array';
+ case '[object String]': return 'string';
}
if (val === null) return 'null';
Something went wrong with that request. Please try again.