Skip to content

josemarluedke/ember-cli-numeral

Repository files navigation

WARNING!

You don't need this addon anymore when using ember-auto-import. You can import numeral.js directly from NPM. The only difference in imports will be on locates. Instead of importing import 'numeral/pl'; you would import import 'numeral/locales/pl';.

ember-cli-numeral

Build Status Ember Observer Score NPM Version

ES6 accessible module for Numeral.js within your Ember applications.

Install

ember install ember-cli-numeral

Usage

import numeral from 'numeral';

let string = numeral(1000).format('0,0');
// '1,000'

See the Numeral.js docs for general usage.

Including Numeral.js locales

To include all the Numeral.js locales definitions, you need to add the following configuration to your ember-cli-build.js.

let app = new EmberApp(defaults, {
  numeral: {
    includeLocales: ['en-gb', 'pl']
  }
});

Then import locales to register them, and activate them:

import numeral from 'numeral';
import 'numeral/en-gb';
import 'numeral/pl';

let string = numeral.locale('pl') && numeral(1000).format('0,0 $');

numeral.locale('en-gb');
let string2 = numeral(50).format('0.0[0]');

numeral.locale('en');

Note: the "en" locale is loaded by default.

FastBoot compatibility

This addon is compatible with FastBoot out of the box.

License

ember-cli-numeral shims is MIT Licensed.

About

ES6 accessible module for Numeral.js within your Ember applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •