Skip to content

Commit

Permalink
v0.3.14 released
Browse files Browse the repository at this point in the history
fix the `byte`, `short` and `int` higher boundary on the `Message.Encoder` class
  • Loading branch information
TheNorthMemory committed Dec 4, 2022
1 parent 976b3ef commit ea355c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ new Tmc('your_app_key', 'your_app_secret', { autoReplyConfirmation: false })
- [淘宝开放平台-消息服务使用介绍](https://open.taobao.com/doc.htm?docId=101663&docType=1)
## 变更历史
It used [the github release page for the Changelog](releases) here.
## License
[MIT](LICENSE)
6 changes: 3 additions & 3 deletions lib/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ class Encoder {

if (type === 'number') {
switch (true) {
case value >= -128 && value < 127:
case value >= -128 && value < 128: //[-(2**7), 2**7)
return this.put(Byte).put(value);

case value >= -32_768 && value < 32_767:
case value >= -32_768 && value < 32_768: //[-(2**15), 2**15)
return this.put(Int16).putShort(value);

case value >= -2_147_483_648 && value < 2_147_483_647:
case value >= -2_147_483_648 && value < 2_147_483_648: //[-(2**31), 2**31)
return this.put(Int32).putInt(value);

default:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tmc.js",
"version": "0.3.13",
"version": "0.3.14",
"description": "Events driven and chained Taobao Message Channel(TMC) for NodeJS",
"author": "James ZHANG",
"license": "MIT",
Expand Down

0 comments on commit ea355c9

Please sign in to comment.