Conversation
Member
|
LGTM, to answer @zbraniecki I'm fine with keeping this current spec text organization as it does not seem to ask for implementations to make normative changes vs ECMA 402 v2 AFAIK (unless the refactoring makes the spec text not fit with certain locales, which I don't know how to evaluate personally). cc @jshin |
Contributor
Author
|
@littledan it will not require normative changes, that's the whole point. |
Member
|
LGTM |
stasm
added a commit
to stasm/ecma402
that referenced
this pull request
Aug 8, 2017
`Intl.NumberFormat.formatToParts` was first propsed in tc39#30. The spec for it was created in tc39#79 and merged in tc39#100. Due to browser implemantations not being ready at the time, it was moved back to Stage 3 in tc39#101. The internal refactorings were kept in master and the user-facing method `formatToParts` was removed from the spec in tc39#102. As of August 1st, 2017, `Intl.NumberFormat.prototype.formatToParts` has shipped in two engines (behind a flag): SpiderMonkey and V8. This PR brings `Intl.NumberFormat.formatToParts` back as Stage 4 proposal. > const usd = Intl.NumberFormat('en', { style: 'currency', currency: 'USD' }); > usd.format(123456.789) '$123,456.79' > usd.formatToParts(123456.789) [ { type: 'currency', value: '$' }, { type: 'integer', value: '123' }, { type: 'group', value: ',' }, { type: 'integer', value: '456' }, { type: 'decimal', value: '.' }, { type: 'fraction', value: '79' } ] > const pc = Intl.NumberFormat('en', { style: 'percent', minimumFractionDigits: 2 }) > pc.format(-0.123456) '-12.35%' > pc.formatToParts(-0.123456) [ { type: 'minusSign', value: '-' }, { type: 'integer', value: '12' }, { type: 'decimal', value: '.' }, { type: 'fraction', value: '35' }, { type: 'literal', value: '%' } ]
stasm
added a commit
to stasm/ecma402
that referenced
this pull request
Aug 8, 2017
`Intl.NumberFormat.formatToParts` was first propsed in tc39#30. The spec for it was created in tc39#79 and merged in tc39#100 (with follow-ups). Due to browser implementations not being ready at the time, it was moved back to Stage 3 in tc39#101. The internal refactoring were kept in master and the user-facing method `formatToParts` was removed from the spec in tc39#102. As of August 1st, 2017, `Intl.NumberFormat.prototype.formatToParts` has shipped in two engines (behind a flag): SpiderMonkey and V8. This PR brings `Intl.NumberFormat.formatToParts` back as Stage 4 proposal. > const usd = Intl.NumberFormat('en', { style: 'currency', currency: 'USD' }); > usd.format(123456.789) '$123,456.79' > usd.formatToParts(123456.789) [ { type: 'currency', value: '$' }, { type: 'integer', value: '123' }, { type: 'group', value: ',' }, { type: 'integer', value: '456' }, { type: 'decimal', value: '.' }, { type: 'fraction', value: '79' } ] > const pc = Intl.NumberFormat('en', { style: 'percent', minimumFractionDigits: 2 }) > pc.format(-0.123456) '-12.35%' > pc.formatToParts(-0.123456) [ { type: 'minusSign', value: '-' }, { type: 'integer', value: '12' }, { type: 'decimal', value: '.' }, { type: 'fraction', value: '35' }, { type: 'literal', value: '%' } ]
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.
Based on my last conversation with Allen, we can preserve all the internal changes to accommodate
formatToPartswithout having to expose the new API. Let's continue with the editorial changes until we can get this restock again.