Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jsamr/counter-style

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsamr/counter-style

CSS Counter Styles Level 3 and presets

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
210K
decreased by-2.75%
Maintainers
1
Weekly downloads
 
Created

What is @jsamr/counter-style?

@jsamr/counter-style is an npm package that allows you to create and use custom counter styles in JavaScript. It is particularly useful for generating custom list markers in web applications, providing a flexible way to define and apply various counter styles.

What are @jsamr/counter-style's main functionalities?

Creating a Custom Counter Style

This feature allows you to create a custom counter style by specifying the type, symbols, and suffix. The example demonstrates creating a numeric counter style with custom symbols and a suffix.

const { counterStyle } = require('@jsamr/counter-style');

const myCustomStyle = counterStyle({
  type: 'numeric',
  symbols: ['A', 'B', 'C', 'D', 'E'],
  suffix: ') '
});

console.log(myCustomStyle.renderMarker(1)); // Output: 'A) '
console.log(myCustomStyle.renderMarker(2)); // Output: 'B) '

Using Predefined Counter Styles

This feature provides access to predefined counter styles such as decimal and lowerAlpha. The example shows how to use these predefined styles to render markers.

const { decimal, lowerAlpha } = require('@jsamr/counter-style/presets');

console.log(decimal.renderMarker(1)); // Output: '1'
console.log(lowerAlpha.renderMarker(1)); // Output: 'a'

Customizing Existing Counter Styles

This feature allows you to customize existing counter styles by modifying their properties. The example demonstrates adding a suffix to the decimal counter style.

const { decimal } = require('@jsamr/counter-style/presets');

const customDecimal = decimal.withSuffix('.');

console.log(customDecimal.renderMarker(1)); // Output: '1.'
console.log(customDecimal.renderMarker(2)); // Output: '2.'
0

Keywords

FAQs

Package last updated on 28 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc