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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
$.each(items, (i, el) => { | |
sumData += el.data1 | |
}) | |
resolve(sumData) | |
}) | |
} |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
let i = noItems | |
while(i--) { | |
sumData += items[i].data1 | |
} | |
resolve(sumData) | |
}) | |
} |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
let i = noItems | |
while(i--) { | |
sumData += items[i].data1 | |
} | |
resolve(sumData) | |
}) | |
} |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
let i = noItems | |
while(i--) { | |
sumData += items[i].data1 | |
} | |
resolve(sumData) | |
}) | |
} |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
const sumData = items.reduce((acc, curr) => {return acc + curr.data1}, 0) | |
resolve(sumData) | |
}) | |
} |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
_.forEach(items, el => { sumData += el.data1 }) | |
resolve(sumData) | |
}) | |
} |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
const sumData = _.sumBy(items, el => {return el.data1}) | |
resolve(sumData) | |
}) | |
} |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let iterations = parseInt(noItems / 8, 10) | |
// get remainder | |
let i = noItems % 8 | |
let sumData = 0 | |
if (i > 0) { | |
while(i) { | |
sumData += items[i--].data1 |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
for(let item of items) { | |
sumData += item.data1 | |
} | |
resolve(sumData) | |
}) | |
} |
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
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
for (let i = 0; i < noItems; i++) { | |
sumData += items[i].data1 | |
} | |
resolve(sumData) | |
}) | |
} |