-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Description
I'm so confused. In general case, we name the function like 'verb-what' like getItem, setQuantity, request, etc.
On case of GET functions, we can guess what type or what kind of values will return.
How about the function which return promise witch will return some other values?
Or, a just Promise. How should I name that?
For example, there are a promise which will query the user's name from database, should the promise name be getName ? or getNamePromise?
In first case(getName), other co-worker could misguess that this function will return name synchronously, so he could directly assign the variables value, like this,
const name = getName();
console.log(name) // Promise {[[PromiseStatus]]: "pending"....}
it doesn't seem good to add 'Async' suffix (getNameAsync).
adding prefix 'promise' ( promiseGetName ) neither.
promiseGettingName
gettingName
...
hmm....
Any good idea for this?