Skip to content

Commit

Permalink
feat: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mys1024 committed Mar 26, 2024
1 parent 6a1fd1a commit c350e19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function fib(n) {
return n <= 2 ? 1 : fib(n - 1) + fib(n - 2);
}

defineWorkerFn("add", add, { port: parentPort! });
defineWorkerFn("fib", fib, { port: parentPort! });
defineWorkerFn("add", add, { port: parentPort });
defineWorkerFn("fib", fib, { port: parentPort });
```
`math.js`:
Expand Down Expand Up @@ -118,10 +118,10 @@ console.log(await fib(5)); // 5
import { defineWorkerFns } from "worker-fn";

const fns = {
add(a: number, b: number) {
add(a, b) {
return a + b;
},
fib(n: number): number {
fib(n) {
return n <= 2 ? 1 : fns.fib(n - 1) + fns.fib(n - 2);
},
};
Expand Down
8 changes: 4 additions & 4 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ function fib(n) {
return n <= 2 ? 1 : fib(n - 1) + fib(n - 2);
}

defineWorkerFn("add", add, { port: parentPort! });
defineWorkerFn("fib", fib, { port: parentPort! });
defineWorkerFn("add", add, { port: parentPort });
defineWorkerFn("fib", fib, { port: parentPort });
```
`math.js`:
Expand Down Expand Up @@ -116,10 +116,10 @@ console.log(await fib(5)); // 5
import { defineWorkerFns } from "worker-fn";

const fns = {
add(a: number, b: number) {
add(a, b) {
return a + b;
},
fib(n: number): number {
fib(n) {
return n <= 2 ? 1 : fns.fib(n - 1) + fns.fib(n - 2);
},
};
Expand Down

0 comments on commit c350e19

Please sign in to comment.