https://github.com/josemarluedke/ember-cli-numeral
ES6 accessible module for Numeral.js within your Ember applications.
https://github.com/josemarluedke/ember-cli-numeral
Last synced: 6 months ago
JSON representation
ES6 accessible module for Numeral.js within your Ember applications.
- Host: GitHub
- URL: https://github.com/josemarluedke/ember-cli-numeral
- Owner: josemarluedke
- License: mit
- Created: 2014-10-22T21:01:34.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T21:00:56.000Z (almost 3 years ago)
- Last Synced: 2025-04-06T07:10:02.099Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 828 KB
- Stars: 16
- Watchers: 2
- Forks: 6
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## WARNING!
You don't need this addon anymore when using [ember-auto-import](https://github.com/ef4/ember-auto-import). You can import [numeral.js](https://github.com/adamwdraper/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
[](https://travis-ci.org/josemarluedke/ember-cli-numeral)
[](https://emberobserver.com/addons/ember-cli-numeral)
[](https://www.npmjs.com/package/ember-cli-numeral)ES6 accessible module for Numeral.js within your Ember applications.
## Install
```bash
ember install ember-cli-numeral
```## Usage
```javascript
import numeral from 'numeral';let string = numeral(1000).format('0,0');
// '1,000'
```See the [Numeral.js docs](http://numeraljs.com/) 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`.```javascript
let app = new EmberApp(defaults, {
numeral: {
includeLocales: ['en-gb', 'pl']
}
});
```Then import locales to register them, and activate them:
```javascript
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](http://ember-fastboot.com/) out of the box.
## License
`ember-cli-numeral` shims is MIT Licensed.