npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

liststyletype-formatter

v1.0.0

Published

JavaScript number formatter matching CSS list-style-type formats

Downloads

190

Readme

liststyletype-formatter

Synopsis and Usage

This library formats (ordinal) numbers with JavaScript as CSS would do when using an ordered list or CSS counters.

For instance, to format a number as in lower case Roman format (corresponding to the CSS declaration list-style-type: lower-roman), use

// Node.js
var ListStyleTypeFormatter = require('liststyletype-formatter');
console.log(ListStyleTypeFormatter.format(1234, 'lower-roman'));
<!-- Browser -->
<script src="liststyletype-formatter.js"></script>
<script>
	console.log(ListStyleTypeFormatter.format(1234, 'lower-roman'));
</script>

The following formats are supported:

|Format|Description| |---|---| |arabic-indic|Eastern arabic numerals| |armenian, upper-armenian|Traditional Armenian numbering| |bengali|Bengali numerals| |cambodian, khmer|Khmer numerals| |circle|A hollow circle (for any number)| |cjk-earthly-branch|Numbering used in a Chinese system for reckoning time based on the Chinese zodiac| |cjk-decimal|Han decimal numbers| |cjk-heavenly-stem|Chinese system of ordinals based on the ten days of the week| |cjk-ideographic|CJK (Chinese-Japanese-Korean) ideographic numbering| |decimal|Decimal numbers| |decimal-leading-zero|Decimal numbers with a leading zero if there is only one digit| |devanagari|Devanagari numerals| |disc|A filled disc (for any number)| |ethiopic-numeric|Ethiopic numbering| |georgian|Traditional Georgian numbering| |gujarati|Gujarati numerals| |gurmukhi|Gurmuhki numerals| |hebrew|Traditional Hebrew numbering| |hiragana|Hiragana letters| |hiragana-iroha|Hiragana letters in the old Japanese ordering| |japanese-formal|Japanese formal numbering to be used in legal or financial document| |japanese-informal|Japanese informal numbering| |kannada|Kannada numerals| |katakana|Katakana letters| |katakana-iroha|Katakana letters in the old Japanese ordering| |khmer|Khmer numerals| |korean-hangul-formal|Korean hangul numbering| |korean-hanja-formal|Formal Korean Han numbering| |korean-hanja-informal|Korean Hanja numbering| |lao|Lao numerals| |lower-alpha, lower-latin|Lowercase ASCII letters| |lower-armenian|Traditional Armenian numbering with lowercase letters| |lower-greek|Lowercase classical Greek| |lower-roman|Lowercase Roman numerals| |malayalam|Malayalam numerals| |mongolian|Mongolian numerals| |myanmar|Burmese numerals| |none|Nothing, returns an empty string| |oriya|Oriya (Odia) numerals| |persian|Persian numerals| |simp-chinese-formal|Simplified Chinese formal numbering| |simp-chinese-informal|Simplified Chinese informal numbering| |square|A filled square (for any number)| |tamil|Tamil numerals| |telugu|Telugu numerals| |thai|Thai numerals| |tibetan|Tibetan numerals| |trad-chinese-formal|Traditional Chinese formal numbering| |trad-chinese-informal |Traditional Chinese informal numbering| |upper-alpha, upper-latin|Uppercase ASCII letters| |upper-armenian, armenian|Traditional Armenian numbering| |upper-roman|Uppercase Roman numerals|

For more information, see https://developer.mozilla.org/en/docs/Web/CSS/list-style-type.

Installing

liststyletype-formatter can be installed with npm:

npm install liststyletype-formatter

Building and Testing

To build a browser version of the library, type

npm run build

To run the tests, type

npm test

License

MIT License

Copyright (c) 2017 Matthias Christen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.