web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
913 B

  1. "use strict";
  2. var value = require("./valid-value")
  3. , defineProperty = Object.defineProperty
  4. , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
  5. , getOwnPropertyNames = Object.getOwnPropertyNames
  6. , getOwnPropertySymbols = Object.getOwnPropertySymbols;
  7. module.exports = function (target, source) {
  8. var error, sourceObject = Object(value(source));
  9. target = Object(value(target));
  10. getOwnPropertyNames(sourceObject).forEach(function (name) {
  11. try {
  12. defineProperty(target, name, getOwnPropertyDescriptor(source, name));
  13. } catch (e) { error = e; }
  14. });
  15. if (typeof getOwnPropertySymbols === "function") {
  16. getOwnPropertySymbols(sourceObject).forEach(function (symbol) {
  17. try {
  18. defineProperty(target, symbol, getOwnPropertyDescriptor(source, symbol));
  19. } catch (e) { error = e; }
  20. });
  21. }
  22. if (error !== undefined) throw error;
  23. return target;
  24. };