@ptolemy2002/rgx 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export declare function getProxy(): ProxyConstructor;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProxy = getProxy;
4
+ function getProxy() {
5
+ return Proxy;
6
+ }
@@ -2,3 +2,4 @@ export * from "./createConstructFunction";
2
2
  export * from "./createClassGuardFunction";
3
3
  export * from "./taggedTemplateToArray";
4
4
  export * from "./isConstructor";
5
+ export * from "./getProxy";
@@ -18,3 +18,4 @@ __exportStar(require("./createConstructFunction"), exports);
18
18
  __exportStar(require("./createClassGuardFunction"), exports);
19
19
  __exportStar(require("./taggedTemplateToArray"), exports);
20
20
  __exportStar(require("./isConstructor"), exports);
21
+ __exportStar(require("./getProxy"), exports);
@@ -1,10 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isConstructor = isConstructor;
4
+ const getProxy_1 = require("./getProxy");
4
5
  // This should work for our purposes
5
6
  const handler = { construct() { return handler; } };
7
+ let gaveWarning = false;
6
8
  function isConstructor(value) {
7
9
  try {
10
+ if (typeof (0, getProxy_1.getProxy)() === "undefined") {
11
+ if (!gaveWarning)
12
+ console.log("rgx: Proxy is not supported. Constructor detection will not work properly.");
13
+ gaveWarning = true;
14
+ return false;
15
+ }
8
16
  //@ts-expect-error If the value isn't constructable, the error will be caught.
9
17
  return !!(new (new Proxy(value, handler))());
10
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/rgx",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",