Input Code
function(object, property, value) {
if (object && property) {
object[property] = value;
return true;
}
return false;
}
Actual Output
return object && property && (object[property] = value, true);
Expected Output
return !!(object && property && (object[property]=value));
Details
When a function returns true/false conditionally based on check of input parameters, this seems to be flattened into a single condition using logical operator && in between. Because of that the result of the above function behaves differently in case when input arguments (object, property) are not provided by the client call.
Calling the function originally with no parameters returns "false".
Calling the function after being transformed by minify-simplify with no parameters returns "undefined".
Input Code
Actual Output
Expected Output
Details
When a function returns true/false conditionally based on check of input parameters, this seems to be flattened into a single condition using logical operator && in between. Because of that the result of the above function behaves differently in case when input arguments (object, property) are not provided by the client call.
Calling the function originally with no parameters returns "false".
Calling the function after being transformed by minify-simplify with no parameters returns "undefined".