mod2dom 1.0.0 → 1.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod2dom",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -27,6 +27,7 @@
27
27
  "exports": {
28
28
  ".": "./dist/index.js",
29
29
  "./types": "./dist/types.js",
30
- "./query": "./dist/query.js"
30
+ "./query": "./dist/query.js",
31
+ "./localServices": "./dist/localServices/index.js"
31
32
  }
32
33
  }
@@ -0,0 +1,17 @@
1
+ const mapAsync = async (array: Array<any>, callback: (item: any) => Promise<void>) => {
2
+ const newArray = new Array();
3
+ for (const item of array) {
4
+ newArray.push(await callback(item));
5
+ }
6
+ }
7
+
8
+ export const clipboard = {
9
+ readAll: async function readAll() {
10
+ const r = await navigator.clipboard.read();
11
+ return await mapAsync(r, async (l) => {
12
+ const blob = await l.getType("text/plain");
13
+ const text = await blob.text();
14
+ return text;
15
+ });
16
+ }
17
+ }
@@ -0,0 +1 @@
1
+ export { clipboard } from "./clipboard";