on bbdc676 help sign in
elk/libraries/Native/Basics.js
69 lines 1.7 kB history raw
2Elm.Native.Basics = {};
3Elm.Native.Basics.make = function(elm) {
4 elm.Native = elm.Native || {};
5 elm.Native.Basics = elm.Native.Basics || {};
6 if (elm.Native.Basics.values) return elm.Native.Basics.values;
8 var JS = Elm.Native.JavaScript.make(elm);
9 var Utils = Elm.Native.Utils.make(elm);
11 function div(a,b) { return (a/b)|0; }
12 function rem(a,b) { return a % b; }
13 var mod = Utils.mod;
14 function abs(x) { return x < 0 ? -x : x; }
15 function logBase(base,n) { return Math.log(n) / Math.log(base); }
16 function min(a,b) { return Utils.cmp(a,b) < 0 ? a : b; }
17 function max(a,b) { return Utils.cmp(a,b) > 0 ? a : b; }
18 function clamp(lo,hi,n) {
19 return Utils.cmp(n,lo) < 0 ? lo : Utils.cmp(n,hi) > 0 ? hi : n; }
20 function xor(a,b) { return a !== b; }
21 function not(b) { return !b; }
23 function truncate(n) { return n|0; }
25 function curry(f,a,b) { return f(Utils.Tuple2(a,b)); }
26 function uncurry(f,v) { return A2(f,v._0,v._1); }
27 function fst(t) { return t._0; }
28 function snd(t) { return t._1; }
30 var basics = {
31 div:F2(div),
32 rem:F2(rem),
33 mod:mod,
35 pi:Math.PI,
36 e:Math.E,
37 cos:Math.cos,
38 sin:Math.sin,
39 tan:Math.tan,
40 acos:Math.acos,
41 asin:Math.asin,
42 atan:Math.atan,
43 atan2:F2(Math.atan2),
45 sqrt:Math.sqrt,
46 abs:abs,
47 logBase:F2(logBase),
48 min:F2(min),
49 max:F2(max),
50 clamp:F3(clamp),
51 compare:Utils.compare,
53 xor:F2(xor),
54 not:not,
56 truncate:truncate,
57 ceiling:Math.ceil,
58 floor:Math.floor,
59 round:Math.round,
60 toFloat:function(x) { return x; },
62 curry:F3(curry),
63 uncurry:F2(uncurry),
64 fst:fst,
65 snd:snd
66 };
68 return elm.Native.Basics.values = basics;
69};