Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for long.js #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

lishengguo
Copy link

writeLong(Long.fromValue(7))

writeLong(Long.fromValue(7))
@mention-bot
Copy link

@lishengguo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fengmk2, @gxcsoccer and @xusiyuan841028 to be potential reviewers.

@codecov
Copy link

codecov bot commented Aug 25, 2017

Codecov Report

Merging #85 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #85   +/-   ##
======================================
  Coverage    96.1%   96.1%           
======================================
  Files           7       7           
  Lines        1079    1079           
  Branches      204     204           
======================================
  Hits         1037    1037           
  Misses         42      42
Impacted Files Coverage Δ
lib/v2/encoder.js 94.57% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e8cfc6...83f6531. Read the comment docs.

@fengmk2
Copy link
Member

fengmk2 commented Oct 18, 2017

any test cases?

@lishengguo
Copy link
Author

add test case : Long.fromNumber(0)

@@ -142,7 +142,7 @@ proto.writeInt = function (val) {
* ```
*/
proto.writeLong = function (val) {
if (typeof val !== 'number' && utility.isSafeNumberString(val)) {
if (typeof val !== 'number' && utility.isSafeNumberString(val + '')) {
Copy link
Member

@fengmk2 fengmk2 Aug 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detect val is not equal string first.

if (typeof val !== 'number') {
  if (typeof val !== 'string') {
    val = val + '';
  }
  if (utility.isSafeNumberString(val)) {
    val = Number(val);
  }
}

@fengmk2 fengmk2 added the bug label Aug 2, 2018
@fengmk2
Copy link
Member

fengmk2 commented Aug 2, 2018

Please rebase from master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants