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
2828 foreign import _charAt
2929 " " "
3030 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;
3332 }
3433 " " " :: forall a. Fn4 Number String (a -> Maybe a ) (Maybe a ) (Maybe Char )
3534
@@ -42,8 +41,7 @@ module Data.String
4241 foreign import _charCodeAt
4342 " " "
4443 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;
4745 }
4846 " " " :: forall a. Fn4 Number String (a -> Maybe a ) (Maybe a ) (Maybe Number )
4947
You can’t perform that action at this time.
0 commit comments