We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 710382e commit 1eca8a1Copy full SHA for 1eca8a1
src/Data/String/Unsafe.js
@@ -5,7 +5,7 @@
5
6
exports.charCodeAt = function (i) {
7
return function (s) {
8
- if (i < 0 || i >= s.length) return s.charCodeAt(i);
+ if (i >= 0 && i < s.length) return s.charCodeAt(i);
9
throw new Error("Data.String.Unsafe.charCodeAt: Invalid index.");
10
};
11
@@ -18,6 +18,6 @@ exports.charAt = function (i) {
18
19
20
exports.char = function (s) {
21
- if (s.length !== 1) return s.charAt(0);
+ if (s.length === 1) return s.charAt(0);
22
throw new Error("Data.String.Unsafe.char: Expected string of length 1.");
23
0 commit comments