File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,7 @@ module Data.String
28
28
foreign import _charAt
29
29
" " "
30
30
function _charAt(i, s, Just, Nothing) {
31
- if (i < 0 || i >= s.length) return Nothing;
32
- else return Just(s.charAt(i));
31
+ return i >= 0 && i < s.length ? Just(s.charAt(i)) : Nothing;
33
32
}
34
33
" " " :: forall a. Fn4 Number String (a -> Maybe a ) (Maybe a ) (Maybe Char )
35
34
@@ -42,8 +41,7 @@ module Data.String
42
41
foreign import _charCodeAt
43
42
" " "
44
43
function _charCodeAt(i, s, Just, Nothing) {
45
- if (i < 0 || i >= s.length) return Nothing;
46
- else return Just(s.charCodeAt(i));
44
+ return i >= 0 && i < s.length ? Just(s.charCodeAt(i)) : Nothing;
47
45
}
48
46
" " " :: forall a. Fn4 Number String (a -> Maybe a ) (Maybe a ) (Maybe Number )
49
47
You can’t perform that action at this time.
0 commit comments