index.js 384 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 (!obj.hasOwnProperty(prop)) {
  11. obj[prop] = proto[prop]
  12. }
  13. }
  14. return obj
  15. }