From 869d8eb34fd0c04892c076953d1af85d96ab6b85 Mon Sep 17 00:00:00 2001 From: Sebastian Claesson Date: Tue, 23 Apr 2013 09:25:17 +0200 Subject: [PATCH] Pluralize ids don't always work The pluralization of the ids did not work on subsequent calls. Now we reset lastIndex of the Regexp-object on each call. Full explanation: http://stackoverflow.com/questions/4724701/regexp-exec-returns-null-sporadically --- lib/util/inflector.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/util/inflector.js b/lib/util/inflector.js index 0d971ad..cf55b41 100644 --- a/lib/util/inflector.js +++ b/lib/util/inflector.js @@ -65,6 +65,7 @@ var inflector = { while (i--) { var rule = rules[i][0]; + rule.lastIndex = 0; if(rule.test(word)) { return word.replace(rule, rules[i][1]);