Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Icu formatters #36

Merged
merged 10 commits into from
Jan 16, 2014
Merged

Icu formatters #36

merged 10 commits into from
Jan 16, 2014

Conversation

apipkin
Copy link
Contributor

@apipkin apipkin commented Jan 16, 2014

Add ICU Formatters as a protected object so overrides are not available as they wouldn't be available in the Intl.MessageFormat

@@ -123,12 +236,12 @@
this.pattern = pattern;

// store formatters
this.formatters = {};
this.formatters = DEFAULT_FORMATTERS;
Copy link
Collaborator

Choose a reason for hiding this comment

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

DEFAULT_FORMATTERS is a class level structure, and optFieldFormatters is an instance level structure. We could use prototype chain here to make sure that an instance is not going to modify the default formatters:

this.formatters = optFieldFormatters || {};
this.formatters.__proto__ = DEFAULT_FORMATTERS;

the rest is not needed. In the case of the custom_ this is really not necessary because that type does not exists.

@caridy
Copy link
Collaborator

caridy commented Jan 16, 2014

LGTM

@apipkin apipkin merged commit a2cd9d2 into formatjs:master Jan 16, 2014
@apipkin apipkin deleted the icu-formatters branch January 16, 2014 23:51
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.

2 participants