File tree Expand file tree Collapse file tree 6 files changed +25
-39
lines changed Expand file tree Collapse file tree 6 files changed +25
-39
lines changed Original file line number Diff line number Diff line change 1
1
.DS_Store
2
2
* .log
3
- .nyc_output /
4
3
coverage /
5
4
node_modules /
6
- hast-util-has-property.js
7
- hast-util-has-property.min.js
8
5
yarn.lock
Original file line number Diff line number Diff line change 1
1
coverage /
2
- hast-util-has-property.js
3
- hast-util-has-property.min.js
4
- * .json
5
2
* .md
Original file line number Diff line number Diff line change 1
- 'use strict'
2
-
3
1
var own = { } . hasOwnProperty
4
2
5
- module . exports = hasProperty
6
-
7
3
// Check if `node` has a set `name` property.
8
- function hasProperty ( node , name ) {
4
+ export function hasProperty ( node , name ) {
9
5
var value =
10
6
node &&
11
7
node . type === 'element' &&
Original file line number Diff line number Diff line change 24
24
"contributors" : [
25
25
" Titus Wormer <tituswormer@gmail.com> (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
"devDependencies" : {
31
- "browserify" : " ^17.0.0" ,
32
- "nyc" : " ^15.0.0" ,
34
+ "c8" : " ^7.0.0" ,
33
35
"prettier" : " ^2.0.0" ,
34
36
"remark-cli" : " ^9.0.0" ,
35
37
"remark-preset-wooorm" : " ^8.0.0" ,
36
38
"tape" : " ^5.0.0" ,
37
- "tinyify" : " ^3.0.0" ,
38
- "xo" : " ^0.38.0"
39
+ "xo" : " ^0.39.0"
39
40
},
40
41
"scripts" : {
41
42
"format" : " remark . -qfo && prettier . -w --loglevel warn && xo --fix" ,
42
- "build-bundle" : " browserify . -s hastUtilHasProperty -o hast-util-has-property.js" ,
43
- "build-mangle" : " browserify . -s hastUtilHasProperty -o hast-util-has-property.min.js -p tinyify" ,
44
- "build" : " npm run build-bundle && npm run build-mangle" ,
45
- "test-api" : " node test" ,
46
- "test-coverage" : " nyc --reporter lcov tape test.js" ,
47
- "test" : " npm run format && npm run build && npm run test-coverage"
43
+ "test-api" : " node test.js" ,
44
+ "test-coverage" : " c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js" ,
45
+ "test" : " npm run format && npm run test-coverage"
48
46
},
49
47
"prettier" : {
50
48
"tabWidth" : 2 ,
56
54
},
57
55
"xo" : {
58
56
"prettier" : true ,
59
- "esnext" : false ,
60
- "ignores" : [
61
- " hast-util-has-property.js"
62
- ]
63
- },
64
- "nyc" : {
65
- "check-coverage" : true ,
66
- "lines" : 100 ,
67
- "functions" : 100 ,
68
- "branches" : 100
57
+ "rules" : {
58
+ "no-var" : " off" ,
59
+ "prefer-arrow-callback" : " off"
60
+ }
69
61
},
70
62
"remarkConfig" : {
71
63
"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,11 +25,11 @@ npm install hast-util-has-property
22
25
## Use
23
26
24
27
``` js
25
- var has = require ( ' hast-util-has-property' )
28
+ import { hasProperty } from ' hast-util-has-property'
26
29
27
- has ({type: ' text' , value: ' alpha' }, ' bravo' ) // => false
30
+ hasProperty ({type: ' text' , value: ' alpha' }, ' bravo' ) // => false
28
31
29
- has (
32
+ hasProperty (
30
33
{
31
34
type: ' element' ,
32
35
tagName: ' div' ,
36
39
' className'
37
40
) // => false
38
41
39
- has (
42
+ hasProperty (
40
43
{
41
44
type: ' element' ,
42
45
tagName: ' div' ,
49
52
50
53
## API
51
54
55
+ This package exports the following identifiers: ` hasProperty ` .
56
+ There is no default export.
57
+
52
58
### ` hasProperty(node, name) `
53
59
54
60
Check if ` node ` is an [ * element* ] [ element ] that has a ` name `
Original file line number Diff line number Diff line change 1
- 'use strict'
2
-
3
- var test = require ( 'tape' )
4
- var hasProperty = require ( '.' )
1
+ import test from 'tape'
2
+ import { hasProperty } from './index.js'
5
3
6
4
test ( 'hasProperty' , function ( t ) {
7
5
t . equal (
You can’t perform that action at this time.
0 commit comments