Sha256: 45003b70969fa3251d1e283123dba2ce8dfa78217dbaf2ea0600f4be3dc6fe1c

Contents?: true

Size: 938 Bytes

Versions: 19

Compression:

Stored size: 938 Bytes

Contents

var setPrototypeOf = require("./setPrototypeOf");

function isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  if (Reflect.construct.sham) return false;
  if (typeof Proxy === "function") return true;

  try {
    Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}

function _construct(Parent, args, Class) {
  if (isNativeReflectConstruct()) {
    module.exports = _construct = Reflect.construct;
  } else {
    module.exports = _construct = function _construct(Parent, args, Class) {
      var a = [null];
      a.push.apply(a, args);
      var Constructor = Function.bind.apply(Parent, a);
      var instance = new Constructor();
      if (Class) setPrototypeOf(instance, Class.prototype);
      return instance;
    };
  }

  return _construct.apply(null, arguments);
}

module.exports = _construct;

Version data entries

19 entries across 19 versions & 5 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/@babel/runtime/helpers/construct.js
disco_app-0.18.2 test/dummy/node_modules/@babel/runtime/helpers/construct.js
enju_library-0.3.8 spec/dummy/node_modules/@babel/runtime/helpers/construct.js
condenser-0.2 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js
condenser-0.1 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js
condenser-0.0.12 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js
condenser-0.0.11 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js
condenser-0.0.10 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js
condenser-0.0.9 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js
condenser-0.0.8 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js
jester-data-8.0.0 node_modules/@babel/runtime/helpers/construct.js
ezii-os-5.2.1 node_modules/@babel/runtime/helpers/construct.js
ezii-os-2.0.1 node_modules/@babel/runtime/helpers/construct.js
ezii-os-1.1.0 node_modules/@babel/runtime/helpers/construct.js
ezii-os-1.0.0 node_modules/@babel/runtime/helpers/construct.js
condenser-0.0.7 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js
ezii-os-0.0.0.1.0 node_modules/@babel/runtime/helpers/construct.js
ezii-os-0.0.0.0.1 node_modules/@babel/runtime/helpers/construct.js
condenser-0.0.5 lib/condenser/processors/node_modules/@babel/runtime/helpers/construct.js