File tree Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Original file line number Diff line number Diff line change 1
1
// Generated by ReScript, PLEASE EDIT WITH CARE
2
2
3
- import * as Caml_obj from "rescript/lib/es6/caml_obj.js" ;
4
- import * as Caml_option from "rescript/lib/es6/caml_option.js" ;
5
3
6
4
function fromString ( radix , x ) {
7
5
var maybeInt = radix !== undefined ? parseInt ( x , radix ) : parseInt ( x ) ;
@@ -13,19 +11,9 @@ function fromString(radix, x) {
13
11
}
14
12
15
13
function clamp ( min , max , value ) {
16
- var value$1 ;
17
- if ( max !== undefined ) {
18
- var max$1 = Caml_option . valFromOption ( max ) ;
19
- value$1 = Caml_obj . lessthan ( max$1 , value ) ? max$1 : value ;
20
- } else {
21
- value$1 = value ;
22
- }
23
- if ( min === undefined ) {
24
- return value$1 ;
25
- }
26
- var min$1 = Caml_option . valFromOption ( min ) ;
27
- if ( Caml_obj . greaterthan ( min$1 , value$1 ) ) {
28
- return min$1 ;
14
+ var value$1 = max !== undefined && max < value ? max : value ;
15
+ if ( min !== undefined && min > value$1 ) {
16
+ return min ;
29
17
} else {
30
18
return value$1 ;
31
19
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ let fromString = (~radix=?, x) => {
36
36
37
37
external mod : (int , int ) => int = "%modint"
38
38
39
- let clamp = (~min = ?, ~max = ?, value ) => {
39
+ let clamp = (~min = ?, ~max = ?, value ): int => {
40
40
let value = switch max {
41
41
| Some (max ) if max < value => max
42
42
| _ => value
You can’t perform that action at this time.
0 commit comments