4aab34dd by Gary Katsevman

switch to forEach to reduce for main return

1 parent 7865c573
1 /***** Start *****/ 1 /***** Start *****/
2 start 2 start
3 = tags:lines+ .* { 3 = tags:lines+ .* {
4 var obj = {}, 4 var choices = {
5 choices = { 5 segments: 1,
6 segments: 1, 6 comments: 1,
7 comments: 1, 7 playlists: 1
8 playlists: 1 8 };
9 }; 9 return tags.reduce(function(obj, tag) {
10 tags.forEach(function(tag) {
11 for (var p in tag) { 10 for (var p in tag) {
12 if (p in choices) { 11 if (p in choices) {
13 if (Object.prototype.toString.call(obj[p]) === '[object Array]') { 12 if (Object.prototype.toString.call(obj[p]) === '[object Array]') {
...@@ -18,9 +17,10 @@ start ...@@ -18,9 +17,10 @@ start
18 } else { 17 } else {
19 obj[p] = tag[p]; 18 obj[p] = tag[p];
20 } 19 }
20
21 return obj;
21 } 22 }
22 }); 23 }, {});
23 return obj;
24 } 24 }
25 25
26 lines 26 lines
......