The accounting.js module can be used to parse strings into numeric values as we saw earlier in this chapter. It is also very good at preparing numbers for display and provides a number of functions to help with this.
In this recipe, we will look at various methods to display numbers using accounting.js.
Before we begin, let's make sure the accounting.js NPM module is installed:
npm install accounting --save
In this example, we will demonstrate ways to use accounting.js to format numbers:
accounting = require 'accounting'
# formatting as currency (default formatting) console.log accounting.formatMoney 31415.9535 console.log ...