Registry / serialization / ember-cli-accounting

ember-cli-accounting

JSON →
library2.1.0jsnpmunverified

Ember-cli-accounting is an Ember CLI addon that integrates the `accounting.js` library into Ember applications, providing robust number and currency formatting capabilities. It ports `accounting.js` (specifically version 0.4.1 as of addon version 2.1.0) to ES6 modules, allowing for selective imports to optimize bundle size. The addon ships with both JavaScript functions and convenient Handlebars helpers (`format-number`, `format-money`) for use directly in templates. It also supports configuring default formatting options via Ember initializers. The addon's versioning does not match the underlying `accounting.js` library, but the maintainer aims to keep it updated with the original library's bug fixes and features. The current stable version is 2.1.1, with recent updates addressing Ember deprecations. It is distinct from directly including `accounting.js` by offering deep Ember integration and ES module support.

npm install ember-cli-accounting
INSTALL
IMPORT
SIG · EMBER-CLI-ACCOUNTI
E
ember-cli-accounting
serializationjavascriptv2.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

formatMoney
import formatMoney from 'accounting/format-money';
import { formatMoney } from 'accounting'; // Incorrect path const formatMoney = require('accounting/format-money'); // CJS is not the primary usage
Imports individual functions for better tree-shaking. This is the recommended approach for specific needs.
accounting
import accounting from 'accounting';
import * as accounting from 'accounting'; // Not a namespace import const accounting = require('accounting'); // CJS is not the primary usage
Imports the entire accounting.js library object, providing access to all functions and settings.
currency, number
import { currency, number } from 'accounting/settings';
import { settings } from 'accounting'; // Incorrect path import { currency } from 'accounting'; // Incorrect path
Used to configure global default options for currency and number formatting via Ember initializers.

Demonstrates importing specific accounting functions and settings, configuring global defaults via an initializer, and using both JavaScript functions and Handlebars helpers for formatting currency and numbers.

import formatMoney from 'accounting/format-money'; import formatNumber from 'accounting/format-number'; // app/initializers/accounting-defaults.js import { currency, number } from 'accounting/settings'; export default { name: 'accounting-defaults', initialize() { currency.symbol = '€'; currency.format = '%v %s'; // e.g., '123.45 €' number.decimal = ','; number.thousand = '.'; number.precision = 2; } }; // app/components/my-component.js import Component from '@ember/component'; import { computed } from '@ember/object'; export default Component.extend({ price: 12345.67, quantity: 5, formattedPrice: computed('price', function() { return formatMoney(this.price, { symbol: '$', precision: 2 }); // Uses local options }), // In a Handlebars template (app/templates/components/my-component.hbs): // <h1>Product Details</h1> // <p>Price: {{format-money price}}</p> <!-- Uses initializer defaults: '12.345,67 €' --> // <p>Quantity: {{format-number quantity}}</p> <!-- Uses initializer defaults: '5' --> // <p>Discounted Price: {{format-money 99.99 symbol='USD' format='%s %v'}}</p> <!-- Overrides for specific use --> });
Debug
Known issues
breakingEmber compatibility requires specific addon versions. Version 1.0.0+ is for Ember 1.13 and 2.0+, while 0.1.x is for Ember 1.10+ (including 1.13) but *not* Ember 2.0. Version 0.0.4 is for older than Ember 1.10.
fix
Consult the 'Ember compatibility' section of the README. For Ember 2.0+, use `ember-cli-accounting@1.0.0` or higher. For Ember 1.10-1.13, use `ember-cli-accounting@0.1.x`. For older Ember versions, use `ember-cli-accounting@0.0.4`.
affects: <1.0.0
deprecatedUsage of `Ember.assign` was deprecated in Ember and has been removed in `ember-cli-accounting` v2.1.1. Using older versions with newer Ember CLI might surface deprecation warnings related to this.
fix
Upgrade to `ember-cli-accounting@2.1.1` or newer to remove the deprecated `Ember.assign` usage.
affects: <2.1.1
gotchaThe addon's versioning (`ember-cli-accounting` vX.Y.Z) does not directly correspond to the version of the `accounting.js` library it bundles. This can be confusing when trying to track features or bug fixes from the upstream library.
fix
To check the bundled `accounting.js` version, import `version` from `accounting/version` (e.g., `import version from 'accounting/version';`). The README states v2.1.0 bundles accounting.js v0.4.1.
affects: >=0.0.1
Errors
Common errors & fixes
DEPRECATION: Ember.assign is deprecated. Please use `Object.assign` instead.
Older versions of `ember-cli-accounting` used `Ember.assign` internally.
fix
Update `ember-cli-accounting` to version 2.1.1 or higher: `ember update ember-cli-accounting` or `npm install ember-cli-accounting@latest`.
Could not find module `accounting/format-money`
Typo in the import path or attempting to `require` an ES module.
fix
Ensure the import path is exact: `import formatMoney from 'accounting/format-money';`. Confirm your Ember CLI project is configured for ES modules.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
accounting.jsrequiredProvides the core number and currency formatting logic; bundled by this addon.
ember-clirequiredRequired for addon functionality and integration into Ember applications.
Agent activity
2 hits · last 30 days
node
2
Resources
ember-cli-accounting — npm install ember-cli-accounting · libregistry