aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-13 22:43:21 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-13 22:43:21 -0800
commitdaf49a0089b9f5e342d3f6ee077d7e284eeb5c1c (patch)
tree9be254364afe3c558ee10ed9e8f7a78df997b116
parent53d6785139fb9f4642d4bc3d48918fbf6f33621d (diff)
blocks.js - avoid an implicit boolean cast.
-rw-r--r--js/lib/blocks.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
index 86064b5..d53a82f 100644
--- a/js/lib/blocks.js
+++ b/js/lib/blocks.js
@@ -65,10 +65,10 @@ var detabLine = function(text) {
// Return index of match or -1.
var matchAt = function(re, s, offset) {
var res = s.slice(offset).match(re);
- if (res) {
- return offset + res.index;
- } else {
+ if (res === null) {
return -1;
+ } else {
+ return offset + res.index;
}
};