/ cloudformation-templates / node_modules / aws-cdk / node_modules / es5-ext / lib / Object / clone.js
clone.js
1 'use strict'; 2 3 var create = Object.create 4 , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor 5 , getOwnPropertyNames = Object.getOwnPropertyNames 6 , getPrototypeOf = Object.getPrototypeOf; 7 8 module.exports = function (obj) { 9 var props = {}; 10 getOwnPropertyNames(obj).forEach(function (name) { 11 props[name] = getOwnPropertyDescriptor(obj, name); 12 }, obj); 13 return create(getPrototypeOf(obj), props); 14 };