Skip to content

Commit b258d44

Browse files
committed
Initial commit
0 parents  commit b258d44

7 files changed

+167
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"deno.enable": false,
3+
"typescript.tsdk": "node_modules\\typescript\\lib",
4+
}

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# `observable-to-async-generator`
2+
3+
Convert an observable to ES6 async generator.
4+
5+
# Import
6+
7+
### TypeScript:
8+
9+
```ts
10+
import otag from "observable-to-async-generator";
11+
```
12+
13+
### JavaScript:
14+
15+
```js
16+
const otag = require("observable-to-async-generator").default;
17+
```
18+
19+
# Usage
20+
21+
```ts
22+
try {
23+
for await (const item of otag(observable))
24+
doSomethingWith(item);
25+
}
26+
27+
catch (error) {
28+
handle(error);
29+
}
30+
```

package-lock.json

+79
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "observable-to-async-generator",
3+
"version": "0.0.1",
4+
"license": "MIT",
5+
"keywords": [
6+
"*",
7+
"async",
8+
"await",
9+
"convert",
10+
"create",
11+
"function*",
12+
"function *",
13+
"generator",
14+
"iterable",
15+
"iterator",
16+
"observable",
17+
"otag",
18+
"yield",
19+
"yield*",
20+
"yield *"
21+
],
22+
"files": [
23+
"/dist",
24+
"/README.md"
25+
],
26+
"main": "dist/index.js",
27+
"types": "dist/index.d.ts",
28+
"scripts": {
29+
"test": "echo \"Error: no test specified\" && exit 1",
30+
"start": "node --require ts-node/register src",
31+
"build": "tsc"
32+
},
33+
"devDependencies": {
34+
"@types/node": "14.0.20",
35+
"ts-node": "8.10.2",
36+
"typescript": "3.9.6"
37+
}
38+
}

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default null;

tsconfig.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2015",
4+
"module": "commonjs",
5+
"outDir": "dist",
6+
"downlevelIteration": true,
7+
"esModuleInterop": true,
8+
9+
"strict": true,
10+
"noUnusedLocals": true,
11+
"forceConsistentCasingInFileNames": true,
12+
}
13+
}

0 commit comments

Comments
 (0)