jscs-dev / jscs-jsdoc

JsDoc validation rules for jscs
MIT License
99 stars 35 forks source link

checkTypes: "natives" should be "primitives" (see notes below) #165

Open gajus opened 8 years ago

gajus commented 8 years ago
typeof true
"boolean"

OK

typeof 1
"number"

OK

typeof 'foo'
"string"

OK

typeof {}
"object"

NOT OK

[].constructor.name
"Array"

OK

new Date().constructor.name
"Date"

OK

/test/.constructor.name
"RegExp"

OK

qfox commented 8 years ago

Well, but:

({}).constructor.name
"Object"

("").constructor.name
"String"
gajus commented 8 years ago

For some reason I assumed that plain object does not have .constructor.name.

qfox commented 8 years ago

@gajus Just noticed that natives should be primitives: https://developer.mozilla.org/en-US/docs/Glossary/Primitive Oopsie!