UNPKG

faye

Version:

Simple pub/sub messaging for the web

20 lines (17 loc) 445 B
'use strict'; var copyObject = function(object) { var clone, i, key; if (object instanceof Array) { clone = []; i = object.length; while (i--) clone[i] = copyObject(object[i]); return clone; } else if (typeof object === 'object') { clone = (object === null) ? null : {}; for (key in object) clone[key] = copyObject(object[key]); return clone; } else { return object; } }; module.exports = copyObject;