Created
October 31, 2025 01:40
-
-
Save rndme/6deb3b0ffea195a365a623a4dbc3e00a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function toSource(o){ // quick and dirty object literals w/ methods. good for refactoring. | |
| var old = Function.prototype.toJSON; | |
| Function.prototype.toJSON = function () { | |
| return "#>"+this.toString()+"<#"; | |
| }; | |
| var s = JSON.stringify(o, null, "\t"); | |
| s=s.replace(/"#>([\w\W]+?)<#"/g, (a,b)=>eval('"'+b+'"')); | |
| Function.prototype.toJSON = old; | |
| return s; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment