File tree 6 files changed +24
-42
lines changed
6 files changed +24
-42
lines changed Original file line number Diff line number Diff line change 1
1
.DS_Store
2
2
* .log
3
3
coverage /
4
- .nyc_output /
5
4
node_modules /
6
- hast-util-script-supporting.js
7
- hast-util-script-supporting.min.js
8
5
yarn.lock
Original file line number Diff line number Diff line change 1
1
coverage /
2
- hast-util-script-supporting.js
3
- hast-util-script-supporting.min.js
4
- * .json
5
2
* .md
Original file line number Diff line number Diff line change 1
- 'use strict'
2
-
3
- module . exports = scriptSupporting
4
-
5
- var is = require ( 'hast-util-is-element' )
6
-
7
- var names = [ 'script' , 'template' ]
1
+ import { convertElement } from 'hast-util-is-element'
8
2
9
3
/* Check if a node is a script-supporting element */
10
- function scriptSupporting ( node ) {
11
- return is ( node , names )
12
- }
4
+ export const scriptSupporting = convertElement ( [ 'script' , 'template' ] )
Original file line number Diff line number Diff line change 24
24
"contributors" : [
25
25
" Titus Wormer <[email protected] > (https://wooorm.com)"
26
26
],
27
+ "sideEffects" : false ,
28
+ "type" : " module" ,
29
+ "main" : " index.js" ,
27
30
"files" : [
28
31
" index.js"
29
32
],
30
33
"dependencies" : {
31
- "hast-util-is-element" : " ^1 .0.0"
34
+ "hast-util-is-element" : " ^2 .0.0"
32
35
},
33
36
"devDependencies" : {
34
- "browserify" : " ^17.0.0" ,
35
- "nyc" : " ^15.0.0" ,
37
+ "c8" : " ^7.0.0" ,
36
38
"prettier" : " ^2.0.0" ,
37
39
"remark-cli" : " ^9.0.0" ,
38
40
"remark-preset-wooorm" : " ^8.0.0" ,
39
41
"tape" : " ^5.0.0" ,
40
- "tinyify" : " ^3.0.0" ,
41
- "xo" : " ^0.38.0"
42
+ "xo" : " ^0.39.0"
42
43
},
43
44
"scripts" : {
44
45
"format" : " remark . -qfo && prettier . -w --loglevel warn && xo --fix" ,
45
- "build-bundle" : " browserify . -s hastUtilScriptSupporting > hast-util-script-supporting.js" ,
46
- "build-mangle" : " browserify . -s hastUtilScriptSupporting -p tinyify > hast-util-script-supporting.min.js" ,
47
- "build" : " npm run build-bundle && npm run build-mangle" ,
48
- "test-api" : " node test" ,
49
- "test-coverage" : " nyc --reporter lcov tape test.js" ,
50
- "test" : " npm run format && npm run build && npm run test-coverage"
51
- },
52
- "nyc" : {
53
- "check-coverage" : true ,
54
- "lines" : 100 ,
55
- "functions" : 100 ,
56
- "branches" : 100
46
+ "test-api" : " node test.js" ,
47
+ "test-coverage" : " c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js" ,
48
+ "test" : " npm run format && npm run test-coverage"
57
49
},
58
50
"prettier" : {
59
51
"tabWidth" : 2 ,
65
57
},
66
58
"xo" : {
67
59
"prettier" : true ,
68
- "esnext " : false ,
69
- "ignores " : [
70
- " hast-util-script-supporting.js "
71
- ]
60
+ "rules " : {
61
+ "no-var " : " off " ,
62
+ "prefer-arrow-callback" : " off "
63
+ }
72
64
},
73
65
"remarkConfig" : {
74
66
"plugins" : [
Original file line number Diff line number Diff line change 13
13
14
14
## Install
15
15
16
+ This package is [ ESM only] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) :
17
+ Node 12+ is needed to use it and it must be ` import ` ed instead of ` require ` d.
18
+
16
19
[ npm] [ ] :
17
20
18
21
``` sh
@@ -22,7 +25,7 @@ npm install hast-util-script-supporting
22
25
## Use
23
26
24
27
``` js
25
- var scriptSupporting = require ( ' hast-util-script-supporting' )
28
+ import { scriptSupporting } from ' hast-util-script-supporting'
26
29
27
30
scriptSupporting ({
28
31
type: ' element' ,
@@ -40,6 +43,9 @@ scriptSupporting({
40
43
41
44
## API
42
45
46
+ This package exports the following identifiers: ` scriptSupporting ` .
47
+ There is no default export.
48
+
43
49
### ` scriptSupporting(node) `
44
50
45
51
Check if the given value is a [ * script-supporting* ] [ spec ] [ * element* ] [ element ] .
Original file line number Diff line number Diff line change 1
- 'use strict'
2
-
3
- var test = require ( 'tape' )
4
- var scriptSupporting = require ( '.' )
1
+ import test from 'tape'
2
+ import { scriptSupporting } from './index.js'
5
3
6
4
test ( 'scriptSupporting' , function ( t ) {
7
5
t . equal ( scriptSupporting ( ) , false , 'should return `false` without node' )
You can’t perform that action at this time.
0 commit comments