"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/es5-ext/object/create.js" (7 Feb 2017, 1004 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 // Workaround for http://code.google.com/p/v8/issues/detail?id=2804
    2 
    3 'use strict';
    4 
    5 var create = Object.create, shim;
    6 
    7 if (!require('./set-prototype-of/is-implemented')()) {
    8     shim = require('./set-prototype-of/shim');
    9 }
   10 
   11 module.exports = (function () {
   12     var nullObject, props, desc;
   13     if (!shim) return create;
   14     if (shim.level !== 1) return create;
   15 
   16     nullObject = {};
   17     props = {};
   18     desc = { configurable: false, enumerable: false, writable: true,
   19         value: undefined };
   20     Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {
   21         if (name === '__proto__') {
   22             props[name] = { configurable: true, enumerable: false, writable: true,
   23                 value: undefined };
   24             return;
   25         }
   26         props[name] = desc;
   27     });
   28     Object.defineProperties(nullObject, props);
   29 
   30     Object.defineProperty(shim, 'nullPolyfill', { configurable: false,
   31         enumerable: false, writable: false, value: nullObject });
   32 
   33     return function (prototype, props) {
   34         return create((prototype === null) ? nullObject : prototype, props);
   35     };
   36 }());