Skip to content
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

Fix #576 for Array when having ports with tuples #585

Merged
merged 6 commits into from
Apr 15, 2014
Merged

Fix #576 for Array when having ports with tuples #585

merged 6 commits into from
Apr 15, 2014

Conversation

xash
Copy link
Contributor

@xash xash commented Apr 15, 2014

No description provided.

@@ -210,6 +210,10 @@ Elm.Native.Utils.make = function(elm) {
return Tuple2(posx, posy);
}

function isJSArray(a) {
return Array.isArray(a);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this function defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It 's in the JS standard library: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
But I just saw that instanceof should be used, because a could be Null. I'll change this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like null instanceof Array is also false. I suspect that using instanceof is faster and it's definitely clearer to me, so I support the change. Should this function ever return true for null though?

@xash xash changed the title Arrays: add toJSArray, fromJSArray and fix #576 Fix #576 for Array when having ports with tuples Apr 15, 2014
@xash
Copy link
Contributor Author

xash commented Apr 15, 2014

Should be good to go! :-)

@evancz
Copy link
Member

evancz commented Apr 15, 2014

Cool, thank you! :D

evancz pushed a commit that referenced this pull request Apr 15, 2014
Fix #576 for Array when having ports with tuples
@evancz evancz merged commit 6467333 into elm:master Apr 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants