index.js 407 B

123456789101112131415161718
  1. 'use strict'
  2. /* eslint no-proto: 0 */
  3. module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties)
  4. function setProtoOf (obj, proto) {
  5. obj.__proto__ = proto
  6. return obj
  7. }
  8. function mixinProperties (obj, proto) {
  9. for (var prop in proto) {
  10. if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
  11. obj[prop] = proto[prop]
  12. }
  13. }
  14. return obj
  15. }