Sha256: 6a476ca15594024457c38c1aae64982e1b3e7c95610f9dc0dc867a7a19edd6d8

Contents?: true

Size: 1013 Bytes

Versions: 6

Compression:

Stored size: 1013 Bytes

Contents

Rev.registerComponent('NumberFormatter', class extends React.Component {

  static get propTypes() {
    return {
      value: React.PropTypes.number.isRequired,
      locales: React.PropTypes.string,
      localeMatcher: React.PropTypes.oneOf(['lookup', 'best fit']),
      style: React.PropTypes.oneOf(['decimal', 'currency', 'percent']),
      currency: React.PropTypes.string,
      currencyDisplay: React.PropTypes.oneOf(['symbol', 'code', 'name']),
      useGrouping: React.PropTypes.bool,
      minimumIntegerDigits: React.PropTypes.number,
      minimumFractionDigits: React.PropTypes.number,
      maximumFractionDigits: React.PropTypes.number,
      minimumSignificantDigits: React.PropTypes.number,
      maximumSignificantDigits: React.PropTypes.number,
    }
  }

  get optionProps() {
    return _.omit(this.props, ['locales', 'value'])
  }

  get text() {
    return this.props.value.toLocaleString(this.props.locales, this.optionProps)
  }

  render() {
    return <span>{this.text}</span>
  }
})

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
revelry_core-0.1.12.6 app/assets/javascripts/revelry/ui/formatting/NumberFormatter.es6
revelry_core-0.1.12.5 app/assets/javascripts/revelry/ui/formatting/NumberFormatter.es6
revelry_core-0.1.12.4 app/assets/javascripts/revelry/ui/formatting/NumberFormatter.es6
revelry_core-0.1.12.3 app/assets/javascripts/revelry/ui/formatting/NumberFormatter.es6
revelry_core-0.1.12.2 app/assets/javascripts/revelry/ui/formatting/NumberFormatter.es6
revelry_core-0.1.12.0 app/assets/javascripts/revelry/ui/formatting/NumberFormatter.es6