Skip to content

Commit 91df0c6

Browse files
committed
Refactor docs
1 parent eb55ee1 commit 91df0c6

File tree

1 file changed

+11
-53
lines changed

1 file changed

+11
-53
lines changed

readme.md

Lines changed: 11 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,16 @@ Check if a [node][] is a (certain) [**HAST**][hast] [element][].
1010
npm install hast-util-is-element
1111
```
1212

13-
**hast-util-is-element** is also available as an AMD, CommonJS, and
14-
globals module, [uncompressed and compressed][releases].
15-
1613
## Usage
1714

18-
Dependencies:
19-
20-
```javascript
21-
var isElement = require('hast-util-is-element');
22-
```
23-
24-
Given a non-element:
25-
2615
```javascript
27-
var result = isElement({
28-
'type': 'text',
29-
'value': 'foo'
30-
});
31-
```
32-
33-
Yields:
16+
var is = require('hast-util-is-element');
3417

35-
```js
36-
false
37-
```
18+
isElement({type: 'text', value: 'foo'}); //=> false
3819

39-
Given a matching element:
20+
is({type: 'element', tagName: 'a'}, 'a'); //=> true
4021

41-
```javascript
42-
result = isElement({
43-
'type': 'element',
44-
'tagName': 'a'
45-
}, 'a');
46-
```
47-
48-
Yields:
49-
50-
```js
51-
true
52-
```
53-
54-
Given multiple tagNames:
55-
56-
```javascript
57-
result = isElement({
58-
'type': 'element',
59-
'tagName': 'a'
60-
}, ['a', 'area']);
61-
```
62-
63-
Yields:
64-
65-
```js
66-
true
22+
is({type: 'element', tagName: 'a'}, ['a', 'area']); //=> true
6723
```
6824

6925
## API
@@ -76,15 +32,19 @@ When not given a second parameter, asserts if `node` is an element,
7632
otherwise asserts `node` is an element whose `tagName` matches / is
7733
included in the second parameter.
7834

79-
**Parameters**:
35+
###### Parameters
8036

8137
* `node` (`*`) — Value to check;
8238
* `tagName` (`string`, optional) — Value `node`s `tagName` must match;
8339
* `tagNames` (`string`, optional) — Value including `node`s `tagName`.
8440

85-
**Returns**: `boolean`, whether `node` passes the test.
41+
######Returns
42+
43+
`boolean` — whether `node` passes the test.
8644

87-
**Throws**: when the second parameter is given but invalid.
45+
###### Throws
46+
47+
`Error` — When the second parameter is given but invalid.
8848

8949
## License
9050

@@ -102,8 +62,6 @@ included in the second parameter.
10262

10363
[npm]: https://docs.npmjs.com/cli/install
10464

105-
[releases]: https://github.com/wooorm/hast-util-is-element/releases
106-
10765
[license]: LICENSE
10866

10967
[author]: http://wooorm.com

0 commit comments

Comments
 (0)