1
1
# hast-util-script-supporting [ ![ Build Status] [ build-badge ]] [ build-page ] [ ![ Coverage Status] [ coverage-badge ]] [ coverage-page ]
2
2
3
- Check if a [ node] [ ] is a [ ** script-supporting** ] [ spec ] [ element] [ ] .
3
+ Check if a [ HAST node] [ hast ] is a [ ** script-supporting** ] [ spec ] [ element] [ ] .
4
4
5
5
## Installation
6
6
@@ -10,57 +10,23 @@ Check if a [node][] is a [**script-supporting**][spec] [element][].
10
10
npm install hast-util-script-supporting
11
11
```
12
12
13
- ** hast-util-script-supporting** is also available as an AMD, CommonJS, and
14
- globals module, [ uncompressed and compressed] [ releases ] .
15
-
16
13
## Usage
17
14
18
- Dependencies:
19
-
20
15
``` javascript
21
16
var scriptSupporting = require (' hast-util-script-supporting' );
22
- ```
23
-
24
- Given a non-script-supporting value:
25
-
26
- ``` javascript
27
- var result = scriptSupporting ({
28
- ' type' : ' element' ,
29
- ' tagName' : ' a' ,
30
- ' properties' : {
31
- ' href' : ' #alpha' ,
32
- ' title' : ' Bravo'
33
- },
34
- ' children' : [{
35
- ' type' : ' text' ,
36
- ' value' : ' Charlie'
37
- }]
38
- });
39
- ```
40
-
41
- Yields:
42
-
43
- ``` js
44
- false
45
- ```
46
-
47
- Given a script-supporting element:
48
17
49
- ``` javascript
50
- result = scriptSupporting ({
51
- ' type' : ' element' ,
52
- ' tagName' : ' template' ,
53
- ' children' : [{
54
- ' type' : ' text' ,
55
- ' value' : ' Delta'
56
- }]
57
- });
58
- ```
59
-
60
- Yields:
61
-
62
- ``` js
63
- true
18
+ scriptSupporting ({
19
+ type: ' element' ,
20
+ tagName: ' a' ,
21
+ properties: {href: ' #alpha' , title: ' Bravo' },
22
+ children: [{type: ' text' , value: ' Charlie' }]
23
+ }); // => false
24
+
25
+ scriptSupporting ({
26
+ type: ' element' ,
27
+ tagName: ' template' ,
28
+ children: [{type: ' text' , value: ' Delta' }]
29
+ }); // => true
64
30
```
65
31
66
32
## API
69
35
70
36
Check if the given value is a [ ** script-supporting** ] [ spec ] [ element] [ ] .
71
37
72
- ** Parameters** : ` node ` (` * ` ) — Value to check.
73
-
74
- ** Returns** : ` boolean ` , whether ` node ` passes the test.
75
-
76
38
## License
77
39
78
40
[ MIT] [ license ] © [ Titus Wormer] [ author ]
@@ -89,13 +51,11 @@ Check if the given value is a [**script-supporting**][spec] [element][].
89
51
90
52
[ npm ] : https://docs.npmjs.com/cli/install
91
53
92
- [ releases ] : https://github.com/wooorm/hast-util-script-supporting/releases
93
-
94
54
[ license ] : LICENSE
95
55
96
56
[ author ] : http://wooorm.com
97
57
98
- [ node ] : https://github.com/wooorm/hast#node
58
+ [ hast ] : https://github.com/wooorm/hast
99
59
100
60
[ element ] : https://github.com/wooorm/hast#element
101
61
0 commit comments