jscs-jsdoc icon indicating copy to clipboard operation
jscs-jsdoc copied to clipboard

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

Open gajus opened this issue 10 years ago • 3 comments

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

gajus avatar Oct 01 '15 13:10 gajus

Well, but:

({}).constructor.name
"Object"

("").constructor.name
"String"

qfox avatar Oct 01 '15 14:10 qfox

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

gajus avatar Oct 01 '15 14:10 gajus

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

qfox avatar Oct 01 '15 14:10 qfox