Created
October 10, 2017 00:35
-
-
Save dperussina/353fdc0d5da8a3903cd7edcaabc20d53 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var orders = [1243, 567, 98978] | |
var orderCount = orders.length - 1; | |
var cache = []; | |
// This version will apply duplicate messages | |
orders.forEach(function(element, iteration, array) { | |
// Gets All messages for each Child | |
cache = GetAllMessages(orders[itteration]); | |
// Applies messages to all orders every iteration | |
ApplyMessagesToOrders(cache); | |
}); | |
var orders = [1243, 567, 98978] | |
var orderCount = orders.length - 1; | |
var cache = []; | |
// This version will concat all messages | |
// Then on the last iteration will apply 1 instance of each | |
// message to each order | |
orders.forEach(function(element, iteration, array) { | |
// Gets all messages for each Child | |
// Concats all messages to a single grouping | |
cache.concat(getOrderMessages(iteration)); | |
// Only applies messages to Each order on the last iteration | |
// Instead of each iteration | |
if(itteration == orderCount){ | |
ApplyMessagesToOrders(cache); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment