Permalink
Browse files

Fix trailing character bug.

1 parent 8ce0d48 commit ff4d23b91a7e0d35ab59f4a66dd8719a1b5082e3 @mickeyreiss mickeyreiss committed Mar 17, 2014
Showing with 38 additions and 8 deletions.
  1. +2 −1 lib/formatter.js
  2. +1 −1 lib/formatter.min.js
  3. +2 −1 lib/jquery.formatter.js
  4. +1 −1 lib/jquery.formatter.min.js
  5. +2 −2 src/pattern.js
  6. +30 −2 test/pattern.js
View
@@ -511,7 +511,7 @@ pattern.parse = function (pattern) {
// Process match or add chars
for (i; i < pLength; i++) {
- if (i == matches[mCount].index) {
+ if (mCount < matches.length && i == matches[mCount].index) {
processMatch(matches[mCount][1]);
} else {
info.chars[i - (mCount * DELIM_SIZE)] = pattern.charAt(i);
@@ -522,6 +522,7 @@ pattern.parse = function (pattern) {
info.mLength = i - (mCount * DELIM_SIZE);
return info;
};
+
//
// Parse a matcher string into a RegExp. Accepts valid regular
// expressions and the catchall '*'.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -507,7 +507,7 @@ pattern.parse = function (pattern) {
// Process match or add chars
for (i; i < pLength; i++) {
- if (i == matches[mCount].index) {
+ if (mCount < matches.length && i == matches[mCount].index) {
processMatch(matches[mCount][1]);
} else {
info.chars[i - (mCount * DELIM_SIZE)] = pattern.charAt(i);
@@ -518,6 +518,7 @@ pattern.parse = function (pattern) {
info.mLength = i - (mCount * DELIM_SIZE);
return info;
};
+
//
// Parse a matcher string into a RegExp. Accepts valid regular
// expressions and the catchall '*'.
Oops, something went wrong.

0 comments on commit ff4d23b

Please sign in to comment.