@prisma-next/utils 0.13.0-dev.15 → 0.13.0-dev.17

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,10 @@
1
+ //#region src/promise.d.ts
2
+ /**
3
+ * Returns true when `value` has a `.then` method, narrowing its type to
4
+ * `PromiseLike<T>`. Safer than `instanceof Promise` because it works across
5
+ * realm boundaries and with any thenable (e.g. custom promise implementations).
6
+ */
7
+ declare function isThenable<T>(value: T | PromiseLike<T>): value is PromiseLike<T>;
8
+ //#endregion
9
+ export { isThenable };
10
+ //# sourceMappingURL=promise.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise.d.mts","names":[],"sources":["../src/promise.ts"],"mappings":";;AAKA;;;;iBAAgB,UAAA,IAAc,KAAA,EAAO,CAAA,GAAI,WAAA,CAAY,CAAA,IAAK,KAAA,IAAS,WAAA,CAAY,CAAA"}
@@ -0,0 +1,13 @@
1
+ //#region src/promise.ts
2
+ /**
3
+ * Returns true when `value` has a `.then` method, narrowing its type to
4
+ * `PromiseLike<T>`. Safer than `instanceof Promise` because it works across
5
+ * realm boundaries and with any thenable (e.g. custom promise implementations).
6
+ */
7
+ function isThenable(value) {
8
+ return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
9
+ }
10
+ //#endregion
11
+ export { isThenable };
12
+
13
+ //# sourceMappingURL=promise.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise.mjs","names":[],"sources":["../src/promise.ts"],"sourcesContent":["/**\n * Returns true when `value` has a `.then` method, narrowing its type to\n * `PromiseLike<T>`. Safer than `instanceof Promise` because it works across\n * realm boundaries and with any thenable (e.g. custom promise implementations).\n */\nexport function isThenable<T>(value: T | PromiseLike<T>): value is PromiseLike<T> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n"],"mappings":";;;;;;AAKA,SAAgB,WAAc,OAAoD;CAChF,OACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,OAAO,MAAM,SAAS;AAE1B"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@prisma-next/utils",
3
- "version": "0.13.0-dev.15",
3
+ "version": "0.13.0-dev.17",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "Shared utility functions for Prisma Next",
8
8
  "devDependencies": {
9
- "@prisma-next/tsconfig": "0.13.0-dev.15",
10
- "@prisma-next/tsdown": "0.13.0-dev.15",
9
+ "@prisma-next/tsconfig": "0.13.0-dev.17",
10
+ "@prisma-next/tsdown": "0.13.0-dev.17",
11
11
  "tsdown": "0.22.1",
12
12
  "typescript": "5.9.3",
13
13
  "vitest": "4.1.8"
@@ -33,6 +33,7 @@
33
33
  "./defined": "./dist/defined.mjs",
34
34
  "./hash-content": "./dist/hash-content.mjs",
35
35
  "./json": "./dist/json.mjs",
36
+ "./promise": "./dist/promise.mjs",
36
37
  "./redact-db-url": "./dist/redact-db-url.mjs",
37
38
  "./result": "./dist/result.mjs",
38
39
  "./simplify-deep": "./dist/simplify-deep.mjs",
@@ -0,0 +1 @@
1
+ export { isThenable } from '../promise';
package/src/promise.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Returns true when `value` has a `.then` method, narrowing its type to
3
+ * `PromiseLike<T>`. Safer than `instanceof Promise` because it works across
4
+ * realm boundaries and with any thenable (e.g. custom promise implementations).
5
+ */
6
+ export function isThenable<T>(value: T | PromiseLike<T>): value is PromiseLike<T> {
7
+ return (
8
+ typeof value === 'object' &&
9
+ value !== null &&
10
+ 'then' in value &&
11
+ typeof value.then === 'function'
12
+ );
13
+ }