-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
for (k in o) loop is broken #33
Comments
Is this fixed in place on latest package? I have following code;
and in JS:
does not work. Meaning does not even go into loop. Any idea on this? |
Hi @reyou , Currently, in njs, you can iterate over only certain properties of request and reply. Because To see reply internal properties of them you can use |
@drsm Please, try this patch for the issue. |
@lexborisov >> var o = { a: 1, b: 1 }; var x = Object.create(o); x.b = 2; x.c = 3;
3
>> var a = []; for(var p in x) a.push(p); a
[
'b',
'c',
'a',
'b'
] |
I solved the problem with duplicate keys. Please, try this three patches. |
@lexborisov Still, with exotic ones there are problems: >> var a = []; for(var p in Object('abc')) a.push(p); a
[
]
>> var a = []; for(var p in Array(3).fill()) a.push(p); a // OK
[
'0',
'1',
'2'
]
>> var o = Object('abc'); var x = Object.create(o); x.a = 1; x.b = 2;
2
>> var a = []; for(var p in x) a.push(p); a
[
'a',
'b'
]
>> var o = Array(3).fill(); var x = Object.create(o); x[1] = 1; x[2] = 2;
2
>> var a = []; for(var p in x) a.push(p); a
[
'1',
'2'
] I think at least the first one should be fixed too. Upd: > var a = []; for(var p in 'abc') a.push(p); a
[ '0', '1', '2' ] |
I understood the problem. The problem here is that the iterator is not implemented for string at all. >> var a = []; for(var p in 'abc') a.push(p); a
[
] I think that tomorrow we will solve this issue. |
It took a little more than one day. Not everything has been implemented yet, which I would like. Please, see this patch. |
@lexborisov |
The text was updated successfully, but these errors were encountered: