Registry / productivity / uxcore-formatter

uxcore-formatter

JSON →
library0.1.13jsnpmunverified

A collection of string formatting utility functions for React components in the uxcore ecosystem. Version 0.1.13, last updated in 2016, appears to be in maintenance mode with no recent releases. Provides methods for date formatting, money (number) formatting with separators and decimal places, Chinese mobile number formatting, and credit card number formatting. Lightweight with no dependencies. Primarily used internally within uxcore projects, not a general-purpose formatter like date-fns or numeral.js.

npm install uxcore-formatter
INSTALL
IMPORT
SIG · UXCORE-FORMATTER
U
uxcore-formatter
productivityjavascriptv0.1.13
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
import Formatter from 'uxcore-formatter'
const Formatter = require('uxcore-formatter')
ESM or CJS both work. The package exports a default object with methods. Named imports (e.g., { date }) will not work.
Formatter.date
import Formatter from 'uxcore-formatter'; Formatter.date(new Date(), 'YYYY-MM-DD')
import { date } from 'uxcore-formatter'
All formatters are methods on the default export. Named import will result in undefined.
Formatter.money
Formatter.money('6566456.65466545', ',', 2)
First argument is a string. Number will be coerced to string. Second argument is separator (space by default), third is decimal places (default 0).

Shows basic usage of all four formatters: date, money, cnmobile, and card.

import Formatter from 'uxcore-formatter'; // Date formatting const dateStr = Formatter.date(new Date(), 'YYYY-MM-DD HH:mm:ss'); console.log(dateStr); // e.g., '2025-03-25 10:30:00' // Money formatting with custom separator and decimal places const moneyStr = Formatter.money('1234567.8912', ',', 2); console.log(moneyStr); // '1,234,567.89' // Chinese mobile number formatting const mobile = Formatter.cnmobile('+8615652988282', ' '); console.log(mobile); // '+86 1565 2988 282' // Credit card formatting const card = Formatter.card('1565298828212233', ' '); console.log(card); // '1565 2988 2821 2233'
Debug
Known issues
gotchaFormatter.money expects a string as first argument; passing a number may cause unexpected behavior with decimal places.
fix
Convert number to string: Formatter.money(String(num), ',', 2)
affects: all
gotchaFormatter.date formatting tokens are custom, not compatible with moment.js or similar libraries.
fix
Refer to source code for exact token mapping (likely YYYY, MM, DD, HH, mm, ss).
affects: all
deprecatedPackage has not been updated since 2016; may contain security issues in dependencies (if any) but no known CVEs.
fix
Consider migrating to modern alternatives like date-fns for date formatting and numeral.js for number formatting.
affects: >=0.1.0
gotchaFormatter.cnmobile expects phone number starting with '+' and country code; without '+' it may not format correctly.
fix
Ensure the phone number includes the '+' sign and country code.
affects: all
Errors
Common errors & fixes
Uncaught TypeError: Formatter.date is not a function
Trying to import as named export: import { date } from 'uxcore-formatter';
fix
Use default import: import Formatter from 'uxcore-formatter'; then Formatter.date().
Formatter.money('12345.6789') returns '12 345.6789' with spaces instead of commas
Default separator is space (' '), not comma.
fix
Pass comma as second argument: Formatter.money('12345.6789', ',') yields '12,345.6789'.
Cannot find module 'uxcore-formatter'
Package not installed or not in package.json.
fix
Run: npm install uxcore-formatter
Upgrade
Version history
0.1.13latest on npm
Audit
Dependencies

No dependency data recorded yet.

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