3 var isPlainObject = require('./is-plain-object')
4 , value = require('./valid-value')
9 copy = function (source) {
13 keys(source).forEach(function (key) {
15 if (!isPlainObject(source[key])) {
16 target[key] = source[key];
19 index = this[0].indexOf(source[key]);
20 if (index === -1) target[key] = copy.call(this, source[key]);
21 else target[key] = this[1][index];
26 module.exports = function (source) {
27 var obj = Object(value(source));
28 if (obj !== source) return obj;
29 return copy.call([[], []], obj);