ROXAN: JSON + Recursive Structures
Installation
npm install rexon
Usage
var rexon = ;var obj = nullMember: null stringMember: "string\n" numberMember: 12 voidMember: void 0 boolMember: true arrayMember: ; objitself = obj;objitselfInArray = obj obj; var result = rexon// result:// {// "nullMember": null,// "stringMember": "string\n",// "numberMember": 12,// "voidMember": undefined,// "boolMember": true,// "arrayMember": [// [],// [// []// ],// [// [// []// ]// ],// [// [// [// []// ]// ]// ],// [// [// [// [// []// ]// ]// ]// ]// ],// "itself": &0,// "itselfInArray": [// &0,// [// &0// ]// ]// }
Streaming
even though, by default, roxan.stringify
returns a whole string after the whole object passed to it has been stringified, this behaviour can be easily customized:
var roxan = ; { console;} var obj = ... // the same value as `obj`, above roxan; // streams `stringify`'s output to stdout as it is getting produced
Please note that roxan.stringify
no longer returns a string when it is provided with a custom rawWrite
.