Created
March 19, 2018 12:47
-
-
Save jacky810124/0b3b9f9487bb200c73a240a6e5280073 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
array = (new Array(5000)).fill(1) | |
task = array.map(item => { | |
return fetch('http://localhost:5000/diandian-landing-payment/us-central1/api/test') | |
}) | |
duplicated = [] | |
Promise | |
.all(task) | |
.then(result => result.map(item => item.json())) | |
.then(result => result.map(item => { | |
return item.orderId | |
})) | |
.then(result => { | |
duplicated = result.filter((item, index) => { | |
if (result.indexOf(item) !== result.lastIndexOf(item) && result.indexOf(item) === index) { | |
return true | |
} | |
return false | |
}) | |
console.log(duplicated) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment