"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/es5-ext/object/mixin-prototypes.js" (7 Feb 2017, 996 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 'use strict';
    2 
    3 var value = require('./valid-value')
    4   , mixin = require('./mixin')
    5 
    6   , defineProperty = Object.defineProperty
    7   , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
    8   , getOwnPropertyNames = Object.getOwnPropertyNames
    9   , getPrototypeOf = Object.getPrototypeOf
   10   , hasOwnProperty = Object.prototype.hasOwnProperty;
   11 
   12 module.exports = function (target, source) {
   13     var error, end, define;
   14     target = Object(value(target));
   15     source = Object(value(source));
   16     end = getPrototypeOf(target);
   17     if (source === end) return target;
   18     try {
   19         mixin(target, source);
   20     } catch (e) { error = e; }
   21     source = getPrototypeOf(source);
   22     define = function (name) {
   23         if (hasOwnProperty.call(target, name)) return;
   24         try {
   25             defineProperty(target, name, getOwnPropertyDescriptor(source, name));
   26         } catch (e) { error = e; }
   27     };
   28     while (source && (source !== end)) {
   29         getOwnPropertyNames(source).forEach(define);
   30         source = getPrototypeOf(source);
   31     }
   32     if (error) throw error;
   33     return target;
   34 };