Skip to content

Instantly share code, notes, and snippets.

@Xedii

Xedii/start.js Secret

Last active January 25, 2019 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xedii/b2420c2b4e2b519d7186040b0d448df5 to your computer and use it in GitHub Desktop.
Save Xedii/b2420c2b4e2b519d7186040b0d448df5 to your computer and use it in GitHub Desktop.
(() => {
requestMock()
.then(res => res.data.arr)
.then(arr => {
if(arr.data.length) {
return requestMock()
.then(nextArr => {
return nextArr.map(nextEl => nextEl+5)
})
} else {
return arr.map(el => el+2)
}
}
})
.then(arr => console.log(arr));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment