Issue
I am new to typescript and I am working on a firebase project where I want to use cloud functions for updating some values in cloud firestore. I wanted to know what's the difference between exports.function_name = code_for_function and export function_name = code_for_function, so that I can use them appropriately.
I saw exports.function_name being used in firebase documentation and export function_name being used in a YouTube video by firebase. So I wanted to know the difference and use cases.
I did read a similar question though it was regarding modules and not functions so I wasn't sure if the same is applicable here.
Solution
exports.XXX is the older CommonJS (CJS) export syntax.
export XXX is the currently dominant MJS standard.
I'd recommend using the latter.
Answered By - AKX
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.