Package list node-nth-check / a023c36
Update README.md Felix Böhm authored 3 years ago GitHub committed 3 years ago
1 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
0 #nth-check [![Build Status](https://travis-ci.org/fb55/nth-check.png)](https://travis-ci.org/fb55/nth-check)
0 # nth-check [![Build Status](https://travis-ci.org/fb55/nth-check.svg)](https://travis-ci.org/fb55/nth-check)
11
22 A performant nth-check parser & compiler.
33
4 ###About
4 ### About
55
66 This module can be used to parse & compile nth-checks, as they are found in CSS 3's `nth-child()` and `nth-last-of-type()`.
77
88 `nth-check` focusses on speed, providing optimized functions for different kinds of nth-child formulas, while still following the [spec](http://www.w3.org/TR/css3-selectors/#nth-child-pseudo).
99
10 ###API
10 ### API
1111
1212 ```js
1313 var nthCheck = require("nth-check");
1414 ```
1515
16 #####`nthCheck(formula)`
16 ##### `nthCheck(formula)`
1717
1818 First parses, then compiles the formula.
1919
20 #####`nthCheck.parse(formula)`
20 ##### `nthCheck.parse(formula)`
2121
2222 Parses the expression, throws a `SyntaxError` if it fails, otherwise returns an array containing two elements.
2323
2727 nthCheck.parse("2n+3") //[2, 3]
2828 ```
2929
30 #####`nthCheck.compile([a, b])`
30 ##### `nthCheck.compile([a, b])`
3131
3232 Takes an array with two elements (as returned by `.parse`) and returns a highly optimized function.
3333