niosh-json
Version:
extended json parser and stringify
29 lines (22 loc) • 1.42 kB
JavaScript
String.prototype.ƒj = function() { return JSON.parse(this); }
Object.defineProperty(String.prototype, 'ƒj', {enumerable:false,writable:false,configurable:false});
Error.prototype.ƒj = function(beauty) {
beauty = (typeof beauty == "boolean") ? beauty : false;
if (!beauty) return JSON.stringify(this);
JSON.stringify(this,null,2);
}
Object.defineProperty(Error.prototype, 'ƒj', {enumerable:false,writable:false,configurable:false});
Date.prototype.ƒj = function() { return JSON.stringify(this); }
Object.defineProperty(Date.prototype, 'ƒj', {enumerable:false,writable:false,configurable:false});
RegExp.prototype.ƒj = function() { return JSON.stringify(this); }
Object.defineProperty(RegExp.prototype, 'ƒj', {enumerable:false,writable:false,configurable:false});
Number.prototype.ƒj = function() { return JSON.stringify(this); }
Object.defineProperty(Number.prototype, 'ƒj', {enumerable:false,writable:false,configurable:false});
Boolean.prototype.ƒj = function() { return JSON.stringify(this); }
Object.defineProperty(Boolean.prototype, 'ƒj', {enumerable:false,writable:false,configurable:false});
Object.prototype.ƒj = function(beauty) {
beauty = (typeof beauty == "boolean") ? beauty : false;
if (!beauty) return JSON.stringify(this);
JSON.stringify(this,null,2);
}
Object.defineProperty(Object.prototype, 'ƒj', {enumerable:false,writable:false,configurable:false});