Last active
November 29, 2016 07:33
-
-
Save abdulhannanali/a1d7e62344cec24adb4a770200411122 to your computer and use it in GitHub Desktop.
Question: Is the function that returns a promise can be considered pure? The returned function might be performing I/O
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
import axios from 'axios' | |
/** | |
* getIdentity | |
* returns a Promise provided the name of the user | |
*/ | |
function getIdentity (name) { | |
return axios.get('https://getyourinfo.pk/' + name) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No. Pure functions have two rules:
See "Master the JavaScript Interview: What is a pure function?"