Create a `pure function` checker, that will check if functions are pure.
Closed this issue · 0 comments
trezm commented
Create a TDPureFunctionChecker
that will throw errors if:
- Properties on external variables are changed, e.g.
var s = {}
function() /* t:number */ {
s.a = 1;
return 1;
}
- Parameters are changed, e.g.
function(/* t:Object */ a) /* t:number */{
a.key = 1;
return 1;
}
- If a function does not have an explicit return, e.g.
function() /* t:undefined */ {
console.log('hi');
}