A minimal npm package for formatting monetary values, currently at version 1.9.2. It provides a simple function to convert numbers into Chinese-currency formatted strings (e.g., 元, 角, 分). The package is lightweight with no dependencies and focuses on the specific niche of Chinese money formatting. It has not been updated since its release.
npm install az-money-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Formats a number into Chinese currency string using the single default export.
Ensure to parse strings to numbers: moneyFormat(parseFloat(input))
Use toFixed(2) or round before formatting: moneyFormat(Math.round(num * 100) / 100)
Check sign before formatting: if (num < 0) throw new Error('Negative not supported')Create a .d.ts file: declare module 'az-money-formatter';
Add a declaration file: // @ts-ignore or create a .d.ts with 'declare module "az-money-formatter"'
Use default import: import moneyFormat from 'az-money-formatter'
Validate input: if (typeof num !== 'number' || isNaN(num)) return '';
No dependency data recorded yet.