File tree 5 files changed +37
-40
lines changed
5 files changed +37
-40
lines changed Original file line number Diff line number Diff line change
1
+ coverage /
2
+ hast-util-script-supporting.js
3
+ hast-util-script-supporting.min.js
Original file line number Diff line number Diff line change 1
- 'use strict' ;
1
+ 'use strict'
2
2
3
- /* Expose. */
4
- module . exports = scriptSupporting ;
3
+ module . exports = scriptSupporting
5
4
6
- /* Dependencies. */
7
- var is = require ( 'hast-util-is-element' ) ;
5
+ var is = require ( 'hast-util-is-element' )
8
6
9
- /* Tag-names. */
10
- var names = [
11
- 'script' ,
12
- 'template'
13
- ] ;
7
+ var names = [ 'script' , 'template' ]
14
8
15
9
/* Check if a node is a script-supporting element */
16
10
function scriptSupporting ( node ) {
17
- return is ( node , names ) ;
11
+ return is ( node , names )
18
12
}
Original file line number Diff line number Diff line change 28
28
"browserify" : " ^16.0.0" ,
29
29
"esmangle" : " ^1.0.1" ,
30
30
"nyc" : " ^12.0.0" ,
31
+ "prettier" : " ^1.13.5" ,
31
32
"remark-cli" : " ^5.0.0" ,
32
33
"remark-preset-wooorm" : " ^4.0.0" ,
33
34
"tape" : " ^4.4.0" ,
34
35
"xo" : " ^0.21.0"
35
36
},
36
37
"scripts" : {
37
- "build-md " : " remark . --quiet --frail --output " ,
38
+ "format " : " remark . -qfo && prettier --write '**/*.js' && xo --fix " ,
38
39
"build-bundle" : " browserify index.js --bare -s hastUtilScriptSupporting > hast-util-script-supporting.js" ,
39
40
"build-mangle" : " esmangle hast-util-script-supporting.js > hast-util-script-supporting.min.js" ,
40
- "build" : " npm run build-md && npm run build-bundle && npm run build-mangle" ,
41
- "lint" : " xo" ,
42
- "test-api" : " node test.js" ,
41
+ "build" : " npm run build-bundle && npm run build-mangle" ,
42
+ "test-api" : " node test" ,
43
43
"test-coverage" : " nyc --reporter lcov tape test.js" ,
44
- "test" : " npm run build && npm run lint && npm run test-coverage"
44
+ "test" : " npm run format && npm run build && npm run test-coverage"
45
45
},
46
46
"nyc" : {
47
47
"check-coverage" : true ,
48
48
"lines" : 100 ,
49
49
"functions" : 100 ,
50
50
"branches" : 100
51
51
},
52
+ "prettier" : {
53
+ "tabWidth" : 2 ,
54
+ "useTabs" : false ,
55
+ "singleQuote" : true ,
56
+ "bracketSpacing" : false ,
57
+ "semi" : false ,
58
+ "trailingComma" : " none"
59
+ },
52
60
"xo" : {
53
- "space " : true ,
61
+ "prettier " : true ,
54
62
"esnext" : false ,
55
63
"ignores" : [
56
64
" hast-util-is-element.js"
Original file line number Diff line number Diff line change @@ -13,20 +13,20 @@ npm install hast-util-script-supporting
13
13
## Usage
14
14
15
15
``` javascript
16
- var scriptSupporting = require (' hast-util-script-supporting' );
16
+ var scriptSupporting = require (' hast-util-script-supporting' )
17
17
18
18
scriptSupporting ({
19
19
type: ' element' ,
20
20
tagName: ' a' ,
21
21
properties: {href: ' #alpha' , title: ' Bravo' },
22
22
children: [{type: ' text' , value: ' Charlie' }]
23
- }); // => false
23
+ }) // => false
24
24
25
25
scriptSupporting ({
26
26
type: ' element' ,
27
27
tagName: ' template' ,
28
28
children: [{type: ' text' , value: ' Delta' }]
29
- }); // => true
29
+ }) // => true
30
30
```
31
31
32
32
## API
Original file line number Diff line number Diff line change 1
- 'use strict' ;
1
+ 'use strict'
2
2
3
- var test = require ( 'tape' ) ;
4
- var scriptSupporting = require ( '.' ) ;
3
+ var test = require ( 'tape' )
4
+ var scriptSupporting = require ( '.' )
5
5
6
- test ( 'scriptSupporting' , function ( t ) {
7
- t . equal (
8
- scriptSupporting ( ) ,
9
- false ,
10
- 'should return `false` without node'
11
- ) ;
6
+ test ( 'scriptSupporting' , function ( t ) {
7
+ t . equal ( scriptSupporting ( ) , false , 'should return `false` without node' )
12
8
13
- t . equal (
14
- scriptSupporting ( null ) ,
15
- false ,
16
- 'should return `false` with `null`'
17
- ) ;
9
+ t . equal ( scriptSupporting ( null ) , false , 'should return `false` with `null`' )
18
10
19
11
t . equal (
20
12
scriptSupporting ( { type : 'text' } ) ,
21
13
false ,
22
14
'should return `false` when without `element`'
23
- ) ;
15
+ )
24
16
25
17
t . equal (
26
18
scriptSupporting ( { type : 'element' } ) ,
27
19
false ,
28
20
'should return `false` when with invalid `element`'
29
- ) ;
21
+ )
30
22
31
23
t . equal (
32
24
scriptSupporting ( {
@@ -37,7 +29,7 @@ test('scriptSupporting', function (t) {
37
29
} ) ,
38
30
false ,
39
31
'should return `false` when without not script-supporting'
40
- ) ;
32
+ )
41
33
42
34
t . equal (
43
35
scriptSupporting ( {
@@ -47,7 +39,7 @@ test('scriptSupporting', function (t) {
47
39
} ) ,
48
40
true ,
49
41
'should return `true` when with script-supporting'
50
- ) ;
42
+ )
51
43
52
- t . end ( ) ;
53
- } ) ;
44
+ t . end ( )
45
+ } )
You can’t perform that action at this time.
0 commit comments