akidee / extensions.js

Basic ECMAScript extensions for both client and server. Deprecated!
2 stars 0 forks source link

extendDeep on circular #2

Open dvv opened 14 years ago

dvv commented 14 years ago

Hi!

I get stack overflow when trying to: var o = {query: '....'}; extendDeep(o, {req: req}) where req is node's request (http#IncomingMessage?). Fear, this issue is true for any object with circular references.

Couldn't you fix that?

TIA, --Vladimir

dvv commented 14 years ago

BTW, jQuery copes with the issue right. May be borrow the idea?

akidee commented 14 years ago

I have borrowed the implementaion from ext.js - but why do you use Object.extendDeep() instead of Object.extend() in this case? It is correct that Object.extendDeep() currently does not deal with circular references, so you should take care about which args you pass.

dvv commented 14 years ago

I simply can't take care, for i have no means to check for circular references. Thus I cannot branch to use extend(). jQuery's impl short-circuits if target === source while in-deep, may be we could do the same?

akidee commented 14 years ago

Feel free to fork and implement it against my API. I am sorry, I don't have the time to instantly add requested features.

dvv commented 14 years ago

I see. I'll be waiting :) Everything has its time, you might consider putting that in your TODO

Best regards, --Vladimir