DEV Community

Discussion on: Pure vs Impure Functions

Collapse
 
sebring profile image
J. G. Sebring

I'd like a way to flag pure functions like an annotation or similar. Last time I looked this up I didn't find any so I'm throwing this out - anyone doing this, and how?

example, jsdoc style

/**
* @pure
*/
add (x, y) {
 return x + y
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
mathias54 profile image
Mathias Gheno Azzolini

I would love that too.