documentcloud/underscore — Issue #347: Should _.clone(undefined) return an object?
Author: sylvinus
Created: 2011-10-24 16:40:28+00:00
State: open

I have code like :

```
function(x) {
var y = _x;
var z = y || {"default":true};
}
```

I wanted to convert it as to avoid side effects on x. So I did :

```
function(x) {
var y = _.clone(x);
var z = y || {"default":true};
}
```

But it turns out that when x is undefined (no arguments to the function) _.clone(undefined) will return an object.

I think _.clone(undefined) should return undefined to avoid any surprises, don't you think?