Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Fix function object’s prototype with toStringTag. #85

Merged
merged 2 commits into from Dec 21, 2018

Conversation

StefanYohansson
Copy link
Contributor

@StefanYohansson StefanYohansson commented Jun 13, 2017

Some projects are implementing objects overriding .prototype[Symbol.toStringTag] for better read
in .toString output and "emulate" something fancy like a typed system in javascript. (example project: https://github.com/origamitower/folktale)

Unfortunately, it'll crash this project since it treat non recognized types as "Custom" and current representation is JsonValue.

My patch just check for this case and use object representation instead.

btw, I don't know if it's the best solution for this problem.

Some projects is implementing objects overriding
.prototype[Symbol.toStringTag] for better read
in .toString output and emulate something fancy
like a type system in javascript.

Unfortunately, it'll crash this project since
it treat non recognized types as "Custom"
and current representation is JsonValue.

My patch just check for this case and use
object representation instead.
@zalmoxisus
Copy link
Collaborator

This looks good to me, shouldn't break other cases. I just moved this part to objType. Thanks for the contribution!

@zalmoxisus zalmoxisus merged commit 906cb65 into alexkuz:master Dec 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants