Created
November 17, 2014 18:00
-
-
Save Ginden/696eb2c8e2b7cad4ead1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokens.map(function(el, i, arr) { | |
var nextEl = arr[i + 1]; // get next element in array | |
if (nextEl != null && nextEl.constructor === el.constructor && el.by !== undefined) { | |
nextEl.by += el.by; | |
el.toRemove = true; // mark items to remove | |
} | |
return el; | |
}).filter(function(el) { | |
return !el.toRemove; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment