Repository navigation
Rewrite Node demo examples - #1415
Merged
Merged
Conversation
BYVoid
force-pushed
the
rewrite-node-demos
branch
from
July 9, 2026 00:42
7b2e8af to
7927470
Compare
frankslin
reviewed
Jul 9, 2026
| console.log(converted); | ||
| main().catch((err) => { | ||
| console.error(err); | ||
| throw err; |
Collaborator
There was a problem hiding this comment.
在 .catch 裏重新 throw 會變成 unhandled rejection,Node 會再次輸出錯誤並以非零 exit code 結束。既然這是給用戶抄用的 demo,建議改成:
console.error(err);
process.exitCode = 1;
demo.ts 也有此問題。
Owner
Author
There was a problem hiding this comment.
已修正,demo.js 和 demo.ts 都改成 console.error(err); process.exitCode = 1;,避免在 catch 裏重新 throw。demo.ts 補了最小的 process 型別宣告,讓不安裝 @types/node 時仍可通過型別檢查。
BYVoid
marked this pull request as ready for review
July 9, 2026 00:58
frankslin
reviewed
Jul 9, 2026
Comment on lines
+54
to
+55
| 鼠标: '滑鼠', | ||
| 软件: '軟體', |
Collaborator
There was a problem hiding this comment.
這裡雖然 JSON key 可以是 Unicode,但與 README.md 中所寫的風格不一致,建議統一改用單引號作為 key。
Owner
Author
There was a problem hiding this comment.
已修正,README.md、demo.js 和 demo.ts 裏 inline config 的 Unicode entries key 都統一改成單引號形式。
BYVoid
force-pushed
the
rewrite-node-demos
branch
from
July 9, 2026 00:58
7927470 to
20cd39b
Compare
Collaborator
|
後續是否考慮可將 node streaming API 也完善一下?在 node/cli.js 裡有一個可用的實現,但沒有封裝成公共 API。 |
Owner
Author
你可以考慮實現,目前應該還沒有緊迫性,因爲OpenCC轉換已經夠快了。 |
Update the JavaScript and TypeScript demos to cover the same API surface, including fromConfig inline configuration. Rename the TypeScript demo to node/demo.ts and update the README references.
BYVoid
force-pushed
the
rewrite-node-demos
branch
from
July 9, 2026 01:05
20cd39b to
215e396
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests