// for CMD declare var require: any; declare var module: any; export function copy(raw: any) { var result; if (Array.isArray(raw)) { result = raw.map(function(item) { return copy(item); }); } else if (Object.isObject(raw)) { result = {}; for (var prop in raw) result[prop] = copy(raw[prop]); } else { result = raw; } return result; }