toString should output '[object FormData]'#346
Conversation
|
Hey, thanks for the PR. Do you mind to elaborate on the use case? |
|
I'm not sure about a specification about this, but every object in JavaScript that is a native type has its own matching new Map().toString() // => '[object Map]'
[].toString() // => '[object Array]'
new Request({}) // =>'[object Request]'and so on. Any environment where |
|
I found the spec. http://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%201st%20edition,%20June%201997.pdf Section: 15.2.4.2
|
|
I see. To make it more like the real thing, makes sense. Thanks a lot. |
|
Fantastic. Thanks! It's a good thing for any object that acts as a special type in JavaScript, even if it isn't native such as this case. For example, I was just logging some Immutable.js types and they have their own toString(). https://github.com/facebook/immutable-js/blob/c93bb75ef238371bf3003337c905b1eb31bc2045/src/List.js#L67-L69 |
|
Yeah, I prefer that kind of more meaningful toStrings, maybe something like urlencoded parameters, although it'd be hard to support all kinds of values. And we need to follow native thing anyway. |
|
Published |
new FormData().toString()currently outputs'[object Object]', but it should output'[object FormData]'.