compound-ex4
Version:
Compound-ex4 - MVC framework for NodeJS (ExpressJs 4 version), fork compoundjs(https://github.com/1602/compound)
20 lines (16 loc) • 547 B
JavaScript
;
var value = require('./valid-value')
, defineProperty = Object.defineProperty
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
, getOwnPropertyNames = Object.getOwnPropertyNames;
module.exports = function (target, source) {
var error;
target = Object(value(target));
getOwnPropertyNames(Object(value(source))).forEach(function (name) {
try {
defineProperty(target, name, getOwnPropertyDescriptor(source, name));
} catch (e) { error = e; }
});
if (error !== undefined) throw error;
return target;
};