{"id":347,"date":"2009-04-19T17:28:12","date_gmt":"2009-04-19T22:28:12","guid":{"rendered":"http:\/\/eligrey.com\/?p=347"},"modified":"2009-04-19T17:28:12","modified_gmt":"2009-04-19T22:28:12","slug":"extending-object-prototype-tostring","status":"publish","type":"post","link":"https:\/\/eligrey.com\/blog\/extending-object-prototype-tostring\/","title":{"rendered":"Extending Object.prototype.toString"},"content":{"rendered":"<p><code>Object.prototype.toString<\/code> is a great way to find the &#8220;class&#8221; of an object, but it only works for the native constructors like <code>String<\/code>, <code>Function<\/code>, ect. Due to this limitation, I have created an open source JavaScript library named <a href=\"http:\/\/github.com\/eligrey\/toStringX\">toStringX<\/a> which adds support for non-native constructors so things like the string representation of <code>new Foo<\/code> are <code>[object Foo]<\/code> instead of <code>[object Object]<\/code>. I have also made some examples that you can run to see the toStringX library in action that you can find in the <a href=\"http:\/\/github.com\/eligrey\/toStringX#readme\">toStringX repository README<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Object.prototype.toString is a great way to find the &#8220;class&#8221; of an object, but it only works for the native constructors like String, Function, ect. Due to this limitation, I have created an open source JavaScript library named toStringX which adds support for non-native constructors so things like the string representation of new Foo are [object [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[71,90,91,168,169],"class_list":["post-347","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-hacks","tag-javascript","tag-javascript-libraries","tag-tostring","tag-tostringx"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pfpUD-5B","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/posts\/347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/comments?post=347"}],"version-history":[{"count":0,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/posts\/347\/revisions"}],"wp:attachment":[{"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/media?parent=347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/categories?post=347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/tags?post=347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}