blob: 52590f9383b205940becd98f1bd80565120d653d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
Elm.Native.Reads = {};
Elm.Native.Reads.make = function(localRuntime) {
localRuntime.Native = localRuntime.Native || {};
localRuntime.Native.Reads = localRuntime.Native.Reads || {};
if(localRuntime.Native.Reads.values) {
return localRuntime.Native.Reads.values;
}
var Result = Elm.Result.make(localRuntime);
function div(a, b)
{
return (a/b)|0;
}
function readInt(str) {
var number = Number(str);
return isNaN(number)
? Result.Err("unable to parse '" + str + "' as a number")
: Result.Ok(number);
}
return localRuntime.Native.Reads.values = {
readInt: readInt
};
};
|