Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

clone.js 496B

1234567891011121314151617181920212223
  1. 'use strict'
  2. module.exports = clone
  3. var getPrototypeOf = Object.getPrototypeOf || function (obj) {
  4. return obj.__proto__
  5. }
  6. function clone (obj) {
  7. if (obj === null || typeof obj !== 'object')
  8. return obj
  9. if (obj instanceof Object)
  10. var copy = { __proto__: getPrototypeOf(obj) }
  11. else
  12. var copy = Object.create(null)
  13. Object.getOwnPropertyNames(obj).forEach(function (key) {
  14. Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
  15. })
  16. return copy
  17. }