Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Feb 2, 2012
1 parent 5e82940 commit 0494d4e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/utils.js
Expand Up @@ -227,11 +227,13 @@ var clone = exports.clone = function clone (obj, options) {
if (Array.isArray(obj))
return cloneArray(obj, options);

if (isMongooseObject(obj))
if (options && options.json && 'function' === typeof obj.toJSON)
if (isMongooseObject(obj)) {
if (options && options.json && 'function' === typeof obj.toJSON) {
return obj.toJSON(options);
else
} else {
return obj.toObject(options);
}
}

if ('Object' === obj.constructor.name)
return cloneObject(obj, options);
Expand Down

0 comments on commit 0494d4e

Please sign in to comment.