-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathCore__Int.mjs
More file actions
77 lines (69 loc) · 1.63 KB
/
Copy pathCore__Int.mjs
File metadata and controls
77 lines (69 loc) · 1.63 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Generated by ReScript, PLEASE EDIT WITH CARE
import * as Pervasives from "rescript/lib/es6/pervasives.js";
import * as Core__Array from "./Core__Array.mjs";
function equal(a, b) {
return a === b;
}
function compare(a, b) {
if (a < b) {
return -1;
} else if (a === b) {
return 0;
} else {
return 1;
}
}
function fromString(radix, x) {
var maybeInt = radix !== undefined ? parseInt(x, radix) : parseInt(x);
if (isNaN(maybeInt) || maybeInt > 2147483647 || maybeInt < -2147483648) {
return ;
} else {
return maybeInt | 0;
}
}
function rangeWithOptions(start, end, options) {
var isInverted = start > end;
var n = options.step;
var step;
if (n !== undefined) {
if (n !== 0) {
step = n;
} else {
if (start !== end) {
throw new RangeError("Incorrect range arguments");
}
step = n;
}
} else {
step = isInverted ? -1 : 1;
}
var length;
if (isInverted === step >= 0) {
length = 0;
} else if (step === 0) {
length = options.inclusive === true ? 1 : 0;
} else {
var range = isInverted ? start - end | 0 : end - start | 0;
var range$1 = options.inclusive === true ? range + 1 | 0 : range;
length = Math.ceil(range$1 / Pervasives.abs(step)) | 0;
}
return Core__Array.fromInitializer(length, (function (i) {
return start + Math.imul(i, step) | 0;
}));
}
function range(start, end) {
return rangeWithOptions(start, end, {});
}
var Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
export {
Constants ,
equal ,
compare ,
fromString ,
range ,
rangeWithOptions ,
}
/* No side effect */