@webreflection/utils 0.0.0

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.
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@webreflection/utils",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ "./with-resolvers": "./src/with-resolvers.js",
7
+ "./package.json": "./package.json"
8
+ },
9
+ "keywords": ["shared", "utility", "utils"],
10
+ "author": "Andrea Giammarchi",
11
+ "license": "MIT",
12
+ "description": "A collection of utility functions"
13
+ }
@@ -0,0 +1,15 @@
1
+ //@ts-check
2
+
3
+ /**
4
+ * @template T
5
+ * @typedef {{promise: Promise<T>, resolve: (value: T) => void, reject: (reason?: any) => void}} Resolvers
6
+ */
7
+
8
+ //@ts-ignore
9
+ const withResolvers = Promise.withResolvers;
10
+
11
+ /**
12
+ * @template T
13
+ * @type {() => Resolvers<T>}
14
+ */
15
+ export default withResolvers.bind(Promise);