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 string #34

Merged
merged 5 commits into from
Jun 24, 2020
Merged

Support string #34

merged 5 commits into from
Jun 24, 2020

Conversation

xiaosu12138
Copy link
Contributor

支持string类型的运算,添加yarn test1运行单元测试的命令

@xiaosu12138
Copy link
Contributor Author

这个test命令是跑测试用例使用的吗,我直接拉的代码,没有任何修改,yarn了之后,yarn test就会报这个错,是什么原因呢?然后我加了个test1:“ava”,是可以跑通测试用例的

@codecov
Copy link

codecov bot commented Jun 16, 2020

Codecov Report

Merging #34 into master will decrease coverage by 20.45%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #34       +/-   ##
===========================================
- Coverage   96.77%   76.31%   -20.46%     
===========================================
  Files           1        1               
  Lines          93       76       -17     
  Branches       27       17       -10     
===========================================
- Hits           90       58       -32     
- Misses          3       18       +15     
Impacted Files Coverage Δ
src/index.ts 76.31% <66.66%> (-20.46%) ⬇️

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 c8359aa...76ac303. Read the comment docs.

@camsong
Copy link
Member

camsong commented Jun 17, 2020

不太理解支持string的必要性 +'123' 就可以把 string 转成 number 来处理

@xiaosu12138
Copy link
Contributor Author

xiaosu12138 commented Jun 17, 2020 via email

@xiaosu12138
Copy link
Contributor Author

大牛好,还是想问问是否可以考虑支持string类型的输入

@@ -7,31 +8,31 @@
* 把错误的数据转正
* strip(0.09999999999999998)=0.1
*/
function strip(num: number, precision = 12): number {
return +parseFloat(num.toPrecision(precision));
function strip(num: numType, precision = 15): number {
Copy link
Member

Choose a reason for hiding this comment

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

改成15的原因是什么?

@xiaosu12138
Copy link
Contributor Author

xiaosu12138 commented Jun 18, 2020 via email

@camsong
Copy link
Member

camsong commented Jun 24, 2020

这个库不能确保一定能解决浮点数问题,12 是尝试出来的。Thanks for your contribution

@camsong camsong merged commit 843d343 into nefe:master Jun 24, 2020
@xiaosu12138
Copy link
Contributor Author

xiaosu12138 commented Jun 24, 2020 via email

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

Successfully merging this pull request may close these issues.

None yet

2 participants