betterObjectToString
You might've mistakenly used Javascript's toString()
method of an object before.
var a = {};
console.log( a.toString() );
// [object Object]
// SO USEFUL! THANKS JAVASCRIPT!
So tired of this bullshit. Since it's such a useless goddamn method, I decided just to throw all caution to the wind and write a module that blasts that piece of shit out of existence.
Usage
Install it
npm install better-object-to-string
Use the shit out of it
Object.prototype.toString = require('better-object-to-string');
// NO NO, CROCKFORD IS SHITTING HIS PANTS
var a = { b: 10, c: 'derp', d: ['cheezits', 'talespin', 'ducktails'] };
a.toString();
// '{ "b" : 10, "c" : "derp", "d" : cheezits,talespin,ducktails }'
// OMFG WAY MORE USEFUL!
But, wait, what the shit is up with that array? Oh yeah, it's another stupid, useless toString() method.
Duh, I've already solved it
I don't care
- I don't care about the implications of blowing away
object.toString()
, since it's a useless piece of shit anyway. Who's sitting out there like, "OH SHIT, THIS STUPID MODULE BROKE MY ABILITY FOR MY OBJECT TO TELL US IT'S [object Object]!" - I don't care about your code breaking. If you're using object.toString() right now for any reason, kill yourself.
- I don't care that it's not faster than your shit.
- If you care so much, fix it and submit a pull request. If I'm hammered enough, I'll even pull it in without looking.