Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Numeric Service > Using localized shorten symbol #1716

Merged
merged 7 commits into from
Jun 18, 2018

Conversation

Blackbaud-SteveBrush
Copy link
Member

Addresses: #965

@codecov-io
Copy link

codecov-io commented Jun 1, 2018

Codecov Report

Merging #1716 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1716      +/-   ##
==========================================
+ Coverage   99.98%   99.98%   +<.01%     
==========================================
  Files         409      409              
  Lines        8488     8495       +7     
  Branches     1242     1244       +2     
==========================================
+ Hits         8487     8494       +7     
  Misses          1        1
Impacted Files Coverage Δ
src/modules/numeric/numeric.options.ts 100% <100%> (ø) ⬆️
src/modules/numeric/numeric.service.ts 100% <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 8feb111...1113a17. Read the comment docs.

public format: string = 'number';
public iso: string = 'USD';
public digits = 1;
public format: 'currency' | 'number' = 'number';

Choose a reason for hiding this comment

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

Would this technically be a breaking change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, I suppose, since it might throw a TSLint error for consumers (internally, it wouldn't be a breaking change).

I'll remove it.


let output: string;
if (found) {
output = Number(

Choose a reason for hiding this comment

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

I think the Math.round vs toFixed comment is helpful here. If anything (I know you didn't write it originally), I'd say this section is lacking even more explanation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough. I'll add some of the comments back.

private replaceShortenSymbol(value: string): string {
const result = /(\d)(?!.*\d)/g.exec(value);
const pos = result.index + result.length;
const output = value.substring(0, pos) + this.shortSymbol + value.substring(pos);

Choose a reason for hiding this comment

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

Any reason to create the output variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was an opinionated readability decision on my part: providing a named variable makes it clearer what we're returning.

I can remove it if you hate it.

@Blackbaud-SteveBrush Blackbaud-SteveBrush merged commit 4b23bbc into master Jun 18, 2018
@Blackbaud-SteveBrush Blackbaud-SteveBrush deleted the fix-numeric-localization branch June 18, 2018 15:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants