Registry / productivity / atma-formatter

atma-formatter

JSON →
library0.8.15jsnpmunverified

A utility library for formatting dates, numbers, and strings with localization support. Current version 0.8.15 provides pattern-based formatting for dates (e.g., yyyy-MM-dd), numbers (e.g., ,0.00), and strings (with alignment and pluralization). It works both in Node.js and browser environments. Key differentiators include integration with MaskJS template engine, culture/language support for internationalization, and a unified API for multiple formatting tasks. Compatible with CommonJS and global browser usage. Last updated several years ago and shows low maintenance cadence.

npm install atma-formatter
INSTALL
IMPORT
SIG · ATMA-FORMATTER
A
atma-formatter
productivityjavascriptv0.8.15
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.

default
import fmt from 'atma-formatter'
The package exports a single function that can be used as default import in ESM. However, it is primarily designed for CommonJS.
default (CommonJS)
const Formatter = require('atma-formatter')
import Formatter from 'atma-formatter'
The package uses module.exports, so require() is the primary pattern. Using ESM default import may cause issues in some bundlers.
browser global
window.Formatter
import { formatter } from 'atma-formatter'
In browser, the library exposes a global Formatter object. No import needed.

Demonstrates date formatting with custom pattern, number formatting with decimal places, and string interpolation with placeholders.

// Node.js example with date formatting const Formatter = require('atma-formatter'); const dateStr = Formatter(new Date(), '#d MMM, yyyy (HH:mm)'); // > "1 Jan, 2023 (14:30)" // Number formatting const numStr = Formatter(4500.3851, ',0.00'); // > "4,500.39" // String formatting with placeholders const str = Formatter('Hello {0} - {1}', 'World', 'test'); // > "Hello World - test"
Debug
Known issues
gotchaLibrary is not actively maintained; last update years ago. No TypeScript definitions.
fix
Consider using dayjs, date-fns, or numeral for actively maintained alternatives.
affects: >=0.0.0
gotchaESM import may not work in all environments; use require() for reliable import.
fix
Use CommonJS require('atma-formatter') or configure bundler properly.
affects: >=0.8.0
gotchaThe format function is both the default export and used as a method on the global Formatter object; ensure correct context when calling.
fix
Call Formatter(value, pattern) directly.
affects: >=0.0.0
gotchaDate patterns use #d not dd for single-digit days; inconsistent with common libraries.
fix
Follow documentation patterns carefully (e.g., #d for 1-31, dd for 01-31).
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Formatter is not a function
Using ESM import incorrectly when the package expects CommonJS.
fix
Use const Formatter = require('atma-formatter'); instead of import.
Uncaught ReferenceError: Formatter is not defined
Forgot to include the script tag or require() in browser/Node respectively.
fix
In browser: include the script via <script src="path/to/atma-formatter.js"></script>. In Node: require('atma-formatter').
Cannot read property 'format' of undefined
Calling mask._.format without initializing MaskJS context.
fix
Use the standalone format function: Formatter(value, pattern) instead.
Upgrade
Version history
0.8.15latest on npm
Audit
Dependencies

No dependency data recorded yet.

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