Registry / testing / liststyletype-formatter

liststyletype-formatter

JSON →
library1.0.0jsnpmunverified

JavaScript number formatter that converts integers to CSS list-style-type representations (e.g., decimal, lower-roman, upper-alpha, armenian, cjk-ideographic). Version 1.0.0, last updated in 2017. Supports all standard CSS list-style-type values plus many national/regional variants. Unlike CSS-only solutions, it works in JavaScript environments (Node.js or browser) for use in dynamic content generation, PDFs, or non-HTML contexts. The library provides a single function `format()` taking a number and a style string, returning the formatted string. It has no dependencies and is lightweight. However, it is no longer actively maintained (no updates since 2017).

npm install liststyletype-formatter
INSTALL
IMPORT
SIG · LISTSTYLETYPE-FORM
L
liststyletype-formatter
testingjavascriptv1.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.

ListStyleTypeFormatter
var ListStyleTypeFormatter = require('liststyletype-formatter');
import ListStyleTypeFormatter from 'liststyletype-formatter';
CommonJS only; no ES module build provided.
ListStyleTypeFormatter
const { format } = require('liststyletype-formatter');
import { format } from 'liststyletype-formatter';
Named import for destructured usage; ESM import not supported.
ListStyleTypeFormatter
const ListStyleTypeFormatter = require('liststyletype-formatter'); ListStyleTypeFormatter.format(1234, 'lower-roman');
ListStyleTypeFormatter(1234, 'lower-roman');
The object has a `format` method; it is not callable directly.

Demonstrates formatting numbers using various CSS list-style-type styles with the library's single `format` method.

var ListStyleTypeFormatter = require('liststyletype-formatter'); console.log(ListStyleTypeFormatter.format(1234, 'lower-roman')); console.log(ListStyleTypeFormatter.format(42, 'upper-alpha')); console.log(ListStyleTypeFormatter.format(0, 'decimal-leading-zero')); console.log(ListStyleTypeFormatter.format(5, 'circle')); console.log(ListStyleTypeFormatter.format(2023, 'japanese-informal'));
Debug
Known issues
gotchaUnsupported style names or null/undefined values throw an error with unclear message.
fix
Wrap calls in try/catch or validate the style string against the supported list before calling format().
affects: 1.0.0
gotchaThe library returns '✘' for out-of-range numbers in certain styles (e.g., armenian for numbers > 9999).
fix
Check the return value for the '✘' character to detect unsupported numbers. For such cases, fall back to decimal or another style.
affects: 1.0.0
gotchaNo TypeScript type definitions available.
fix
Manually create a .d.ts file or use // @ts-ignore. Consider migrating to @likelist/liststyletype-formatter which may have TS support.
affects: 1.0.0
deprecatedPackage has not been updated since 2017. No support for new CSS list-style-type values (e.g., 'simp-chinese-formal', 'korean-hangul-formal' are already present but future additions are missing).
fix
Fork the repository and update, or use a more modern alternative like 'css-list-style-type' or implement a custom formatter.
affects: 1.0.0
Errors
Common errors & fixes
TypeError: ListStyleTypeFormatter is not a function
Trying to call the exported object directly instead of accessing its `.format` method.
fix
Use `ListStyleTypeFormatter.format(number, style)` instead of `ListStyleTypeFormatter(number, style)`.
Cannot find module 'liststyletype-formatter'
Package is not installed or is not required correctly.
fix
Run `npm install liststyletype-formatter` and ensure the require path is correct (e.g., `require('liststyletype-formatter')`).
Unsupported style: some-style
Passed a style string that is not in the supported list.
fix
Check the list of supported styles (e.g., 'decimal', 'lower-roman', 'upper-alpha', etc.) and use a valid one.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
liststyletype-formatter — npm install liststyletype-formatter · libregistry