]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/object/set-prototype-of/shim.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / node-gyp / node_modules / path-array / node_modules / array-index / node_modules / es6-symbol / node_modules / es5-ext / object / set-prototype-of / shim.js
diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/object/set-prototype-of/shim.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/object/set-prototype-of/shim.js
new file mode 100644 (file)
index 0000000..4ec9446
--- /dev/null
@@ -0,0 +1,73 @@
+// Big thanks to @WebReflection for sorting this out
+// https://gist.github.com/WebReflection/5593554
+
+'use strict';
+
+var isObject      = require('../is-object')
+  , value         = require('../valid-value')
+
+  , isPrototypeOf = Object.prototype.isPrototypeOf
+  , defineProperty = Object.defineProperty
+  , nullDesc = { configurable: true, enumerable: false, writable: true,
+               value: undefined }
+  , validate;
+
+validate = function (obj, prototype) {
+       value(obj);
+       if ((prototype === null) || isObject(prototype)) return obj;
+       throw new TypeError('Prototype must be null or an object');
+};
+
+module.exports = (function (status) {
+       var fn, set;
+       if (!status) return null;
+       if (status.level === 2) {
+               if (status.set) {
+                       set = status.set;
+                       fn = function (obj, prototype) {
+                               set.call(validate(obj, prototype), prototype);
+                               return obj;
+                       };
+               } else {
+                       fn = function (obj, prototype) {
+                               validate(obj, prototype).__proto__ = prototype;
+                               return obj;
+                       };
+               }
+       } else {
+               fn = function self(obj, prototype) {
+                       var isNullBase;
+                       validate(obj, prototype);
+                       isNullBase = isPrototypeOf.call(self.nullPolyfill, obj);
+                       if (isNullBase) delete self.nullPolyfill.__proto__;
+                       if (prototype === null) prototype = self.nullPolyfill;
+                       obj.__proto__ = prototype;
+                       if (isNullBase) defineProperty(self.nullPolyfill, '__proto__', nullDesc);
+                       return obj;
+               };
+       }
+       return Object.defineProperty(fn, 'level', { configurable: false,
+               enumerable: false, writable: false, value: status.level });
+}((function () {
+       var x = Object.create(null), y = {}, set
+         , desc = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__');
+
+       if (desc) {
+               try {
+                       set = desc.set; // Opera crashes at this point
+                       set.call(x, y);
+               } catch (ignore) { }
+               if (Object.getPrototypeOf(x) === y) return { set: set, level: 2 };
+       }
+
+       x.__proto__ = y;
+       if (Object.getPrototypeOf(x) === y) return { level: 2 };
+
+       x = {};
+       x.__proto__ = y;
+       if (Object.getPrototypeOf(x) === y) return { level: 1 };
+
+       return false;
+}())));
+
+require('../create');