From 890d5f115b063bede084a2508f04601bd218de0e Mon Sep 17 00:00:00 2001 From: Florian Neumann Date: Tue, 15 Apr 2014 13:17:12 +0200 Subject: [PATCH] Exchanged for-each with vanilla for-loop --- timestring.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/timestring.js b/timestring.js index 3a11dd7..06f18d4 100644 --- a/timestring.js +++ b/timestring.js @@ -83,11 +83,10 @@ .match(/[-+]?[0-9]+[a-z]+/g); // match time groups (digit followed by time unit - i.e 5d 15m = 2 time groups) if (groups !== null) { - for(var group in groups) { - var g = groups[group], + for( var i = 0; i < groups.length; i++ ) { + var g = groups[i], value = g.match(/[0-9]+/g)[0], unit = g.match(/[a-z]+/g)[0]; - totalSeconds += getSeconds(value, unit); } }