{"id":16984,"library":"ember-cli-accounting","title":"Ember CLI Addon for Accounting.js","description":"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.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/cibernox/ember-cli-accounting","tags":["javascript","ember-addon","accounting","number","money","currency","format","exchange"],"install":[{"cmd":"npm install ember-cli-accounting","lang":"bash","label":"npm"},{"cmd":"yarn add ember-cli-accounting","lang":"bash","label":"yarn"},{"cmd":"pnpm add ember-cli-accounting","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the core number and currency formatting logic; bundled by this addon.","package":"accounting.js","optional":false},{"reason":"Required for addon functionality and integration into Ember applications.","package":"ember-cli","optional":false}],"imports":[{"note":"Imports individual functions for better tree-shaking. This is the recommended approach for specific needs.","wrong":"import { formatMoney } from 'accounting'; // Incorrect path\nconst formatMoney = require('accounting/format-money'); // CJS is not the primary usage","symbol":"formatMoney","correct":"import formatMoney from 'accounting/format-money';"},{"note":"Imports the entire accounting.js library object, providing access to all functions and settings.","wrong":"import * as accounting from 'accounting'; // Not a namespace import\nconst accounting = require('accounting'); // CJS is not the primary usage","symbol":"accounting","correct":"import accounting from 'accounting';"},{"note":"Used to configure global default options for currency and number formatting via Ember initializers.","wrong":"import { settings } from 'accounting'; // Incorrect path\nimport { currency } from 'accounting'; // Incorrect path","symbol":"currency, number","correct":"import { currency, number } from 'accounting/settings';"}],"quickstart":{"code":"import formatMoney from 'accounting/format-money';\nimport formatNumber from 'accounting/format-number';\n\n// app/initializers/accounting-defaults.js\nimport { currency, number } from 'accounting/settings';\n\nexport default {\n  name: 'accounting-defaults',\n  initialize() {\n    currency.symbol = '€';\n    currency.format = '%v %s'; // e.g., '123.45 €'\n    number.decimal = ',';\n    number.thousand = '.';\n    number.precision = 2;\n  }\n};\n\n// app/components/my-component.js\nimport Component from '@ember/component';\nimport { computed } from '@ember/object';\n\nexport default Component.extend({\n  price: 12345.67,\n  quantity: 5,\n\n  formattedPrice: computed('price', function() {\n    return formatMoney(this.price, { symbol: '$', precision: 2 }); // Uses local options\n  }),\n\n  // In a Handlebars template (app/templates/components/my-component.hbs):\n  // <h1>Product Details</h1>\n  // <p>Price: {{format-money price}}</p>  <!-- Uses initializer defaults: '12.345,67 €' -->\n  // <p>Quantity: {{format-number quantity}}</p> <!-- Uses initializer defaults: '5' -->\n  // <p>Discounted Price: {{format-money 99.99 symbol='USD' format='%s %v'}}</p> <!-- Overrides for specific use -->\n});","lang":"typescript","description":"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."},"warnings":[{"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`.","message":"Ember 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.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Upgrade to `ember-cli-accounting@2.1.1` or newer to remove the deprecated `Ember.assign` usage.","message":"Usage 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.","severity":"deprecated","affected_versions":"<2.1.1"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Update `ember-cli-accounting` to version 2.1.1 or higher: `ember update ember-cli-accounting` or `npm install ember-cli-accounting@latest`.","cause":"Older versions of `ember-cli-accounting` used `Ember.assign` internally.","error":"DEPRECATION: Ember.assign is deprecated. Please use `Object.assign` instead."},{"fix":"Ensure the import path is exact: `import formatMoney from 'accounting/format-money';`. Confirm your Ember CLI project is configured for ES modules.","cause":"Typo in the import path or attempting to `require` an ES module.","error":"Could not find module `accounting/format-money`"}],"ecosystem":"npm","meta_description":null}