Skip to content

Commit 585051f

Browse files
committed
switch order of Parse and Match
1 parent da639ab commit 585051f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ Usage
2323
This package has two exports: `parse()`, and `match()` which can parse CSS Media
2424
Queries and determine if a media query matches a given set of values.
2525

26+
### Matching
27+
28+
The `match()` method lets you compare a media query expression with a JavaScript object and determine if a media query matches a given set of values.
29+
30+
```javascript
31+
var mediaQuery = require('css-mediaquery');
32+
33+
var isMatch = mediaQuery.match('screen and (min-width: 40em)', {
34+
type : 'screen',
35+
width: '1024px'
36+
});
37+
38+
console.log(isMatch); // => true
39+
```
40+
2641
### Parsing
2742

2843
Existing CSS Parsers don't do a great job at parsing the details of media queries. That's where `css-mediaquery` shines. You can parse a media query expression and get an AST back by using the `parse()` method.
@@ -54,21 +69,6 @@ The `ast` variable will have the following payload:
5469

5570
```
5671

57-
### Matching
58-
59-
The `match()` method lets you compare a media query expression with a JavaScript object and determine if a media query matches a given set of values.
60-
61-
```javascript
62-
var mediaQuery = require('css-mediaquery');
63-
64-
var isMatch = mediaQuery.match('screen and (min-width: 40em)', {
65-
type : 'screen',
66-
width: '1024px'
67-
});
68-
69-
console.log(isMatch); // => true
70-
```
71-
7272
This package was written with care to following the W3C Recommendations for
7373
[CSS3 Media Queries][w3c-mq] and [CSS3 Values and Units][w3c-vu]. It supports
7474
all of the [Media Features][w3c-mq-features] and will properly convert values to

0 commit comments

Comments
 (0)