If I have an arrow function like:

```
let fn = x => x.contact.name;

```

Then, I can re-use that `fn` to retrieve the value as:

```
function read(obj) {
    return fn(obj)
}

```

But how can I set values of an object using the property expression in `fn`?

```
function write(obj, newVal) {
    // intending to set obj.contact.name = newVal using fn
}

```

Edit:

(To give a little bit of background)

I am writing a JS library where consumers would provide a lambda expression like above (`fn`), and I provide a read/write functionality somewhere based on the expression. Right now I am using `fn.toString()` and string manipulation as a temporary solution.