As we know, the W3C has introduced an extended CSS Counter Styles
in CSS3, and for the compatibility to simulate it in JavaScript, we may need such an API like what @jsamr/counter-style
has done for us. I think such an implementation can be done in the native specification of JavaScript, and any idea?
const formatter1 = new Intl.CounterFormat('decimal');
console.log(formatter1.format(1)); // => "1."
const formatter2 = new Intl.CounterFormat('lower-roman');
console.log(formatter2.format(1)); // => "i."
const formatter3 = new Intl.CounterFormat('lower-alpha');
console.log(formatter3.format(1)); // => "a."
const formatter4 = new Intl.CounterFormat('simp-chinese-informal');
console.log(formatter4.format(1)); // => "δΈγ"