Registry / productivity / anima-formatter

anima-formatter

JSON →
library2.0.0jsnpmunverified

General-purpose formatting library for Chinese developers, providing date and amount formatting utilities. Current stable version: 2.0.0. Release cadence: unknown, last updated years ago. Key differentiators: built for CommonJS (require), supports Node >=4.0.0, no dependencies. Functionality overlaps with libraries like moment.js or numeral.js but is much simpler.

npm install anima-formatter
INSTALL
IMPORT
SIG · ANIMA-FORMATTER
A
anima-formatter
productivityjavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Formatter
const Formatter = require('anima-formatter')
import Formatter from 'anima-formatter'
CommonJS-only; ESM import will error unless using bundler interop.
dateFormat
Formatter.dateFormat(date)
Formatter.dateFormat(date, formatString)
Only accepts a Date object; no format string parameter.
amountFormat
Formatter.amountFormat(amount, useGrouping, decimalPlaces, showCurrencySymbol)
Formatter.amountFormat(amount)
Parameters are required: (amount, useGrouping, decimalPlaces, showCurrencySymbol). Missing args will cause undefined errors.

Shows basic usage of dateFormat and amountFormat with various options.

const Formatter = require('anima-formatter'); // Format date const date = new Date(2014, 10, 12); const dateStr = Formatter.dateFormat(date); // e.g. '2014-11-12' console.log(dateStr); // Format amount const amount = 4567834.8794; const formattedAmount = Formatter.amountFormat(amount, true, 3, false); // e.g. '4,567,834.879' console.log(formattedAmount); // With currency symbol const formattedWithCurrency = Formatter.amountFormat(amount, false, 2, true); // e.g. '4567834.88¥' (or similar) console.log(formattedWithCurrency); // Note: No ES module export. Use require() only.
Debug
Known issues
gotchaMissing parameters to amountFormat cause undefined behavior.
fix
Always provide all four arguments: amount, useGrouping, decimalPlaces, showCurrencySymbol.
affects: >=1.0.0
gotchadateFormat does not accept a format string; it always returns date in 'YYYY-MM-DD' format.
fix
Use ISOString or a more flexible library like moment.js if custom formats are needed.
affects: >=1.0.0
breakingNode.js >=4.0.0 required; using older Node fails silently or throws.
fix
Upgrade Node to version 4 or higher.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: Formatter.amountFormat is not a function
Importing as ES module (e.g., import) instead of require().
fix
const Formatter = require('anima-formatter');
Formatter.dateFormat(date) returns undefined
date is not a valid Date object (e.g., string or number).
fix
Pass a Date object: new Date('2014-11-12').
Formatter.amountFormat(amount) returns undefined
Too few arguments (only amount provided).
fix
Provide all four arguments: amount, true/false for grouping, number of decimals, true/false for currency symbol.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
37 hits · last 30 days
node
30
OpenAI (training)
1
Resources
anima-formatter — npm install anima-formatter · libregistry