on master help sign in
Merge pull request #585 from Xashili/array
6467333Evan Czaplicki
compiler/Generate/JavaScript/Ports.hs+1−1
@@ -20,7 +20,7 @@ check x jsType continue =
20 JSNumber -> [typeof "number"]
20 JSNumber -> [typeof "number"]
21 JSBoolean -> [typeof "boolean"]
21 JSBoolean -> [typeof "boolean"]
22 JSString -> [typeof "string", instanceof "String"]
22 JSString -> [typeof "string", instanceof "String"]
23− JSArray -> [instanceof "Array"]
23+ JSArray -> [(obj "_U.isJSArray" <|)]
24 JSObject fields -> [jsFold OpLAnd (typeof "object" : map member fields)]
24 JSObject fields -> [jsFold OpLAnd (typeof "object" : map member fields)]
25
25
26incoming :: Type -> Expression ()
26incoming :: Type -> Expression ()
libraries/Native/Utils.js+5
@@ -210,6 +210,10 @@ Elm.Native.Utils.make = function(elm) {
210 return Tuple2(posx, posy);
210 return Tuple2(posx, posy);
211 }
211 }
212
212
213+ function isJSArray(a) {
214+ return a instanceof Array;
215+ }
216+
213 return elm.Native.Utils.values = {
217 return elm.Native.Utils.values = {
214 eq:eq,
218 eq:eq,
215 cmp:cmp,
219 cmp:cmp,
@@ -229,6 +233,7 @@ Elm.Native.Utils.make = function(elm) {
229 mod : F2(mod),
233 mod : F2(mod),
230 htmlHeight: F2(htmlHeight),
234 htmlHeight: F2(htmlHeight),
231 getXY: getXY,
235 getXY: getXY,
236+ isJSArray: isJSArray,
232 toFloat: function(x) { return +x; }
237 toFloat: function(x) { return +x; }
233 };
238 };
234};
239};