You could also use something like the "circular-json" or
"json-stringify-safe" modules.

If node.io is using JSON.stringify just to create an opaque signature,
the "sigmund" module can do that much faster, and is safe for circular
objects.

(All on npm, of course.)

On Wed, Mar 27, 2013 at 1:06 PM, wizard113 <[email protected]> wrote:
> d'oh!
>
> did some reading, and answered my own question.  The post here
> (http://freshbrewedcode.com/jimcowart/2013/01/29/what-you-might-not-know-about-json-stringify/)
> talks about blacklisting members of an object.
>
> Looks like my answer is a PR, to blacklist the 'domain' member of a job in
> node.io ...
>
>
>
> On Wednesday, March 27, 2013 10:56:33 AM UTC-7, wizard113 wrote:
>>
>> Not sure precisely how to address an issue I ran into today, so I thought
>> i'd throw it out there and see what the world says.
>>
>> Using v0.10.1 with module node.io.  I have some code that looks like this:
>>
>> var domain = require('domain');
>> var nodeio = require('node.io');
>>
>> var storage = {};
>>
>> storage.domain = domain.create();
>>
>> storage.job = new nodeio.Job(...);
>>
>> storage.domain.add(storage.job);
>>
>> nodeio.start(job...);
>>
>> At this point, node.io dies, because it attempts to create a unique name
>> for the job by executing JSON.stringify(job).  Because I added the job to
>> the domain, a domain property is now part of the job object, creating a
>> circular reference.
>>
>> My question is, is there a safe way to use JSON.stringify (or other object
>> property traversal methods) on an object that has been added to a domain?
>>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to