Skip to content

Commit 1eca8a1

Browse files
committed
Fix #36
1 parent 710382e commit 1eca8a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Data/String/Unsafe.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
exports.charCodeAt = function (i) {
77
return function (s) {
8-
if (i < 0 || i >= s.length) return s.charCodeAt(i);
8+
if (i >= 0 && i < s.length) return s.charCodeAt(i);
99
throw new Error("Data.String.Unsafe.charCodeAt: Invalid index.");
1010
};
1111
};
@@ -18,6 +18,6 @@ exports.charAt = function (i) {
1818
};
1919

2020
exports.char = function (s) {
21-
if (s.length !== 1) return s.charAt(0);
21+
if (s.length === 1) return s.charAt(0);
2222
throw new Error("Data.String.Unsafe.char: Expected string of length 1.");
2323
};

0 commit comments

Comments
 (0)