mutate() Function
The mutate()
function only works in mutating policies and tells jsPolicy to calculate a patch between the original request.object
and the newly passed object.
As soon as mutate(changedObj)
is called, execution will be stopped. JsPolicy will remember the original request.object
, which means you can freely change this object within the policy and call mutate(request.object)
afterwards.
If the passed object and the original object do not have any differences, jsPolicy will do nothing.