Transforms js objects using specified rules