File tree Expand file tree Collapse file tree 5 files changed +51
-52
lines changed Expand file tree Collapse file tree 5 files changed +51
-52
lines changed Original file line number Diff line number Diff line change 1+ coverage /
2+ hast-util-sectioning.js
3+ hast-util-sectioning.min.js
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ 'use strict'
22
3- /* Dependencies. */
4- var is = require ( 'hast-util-is-element' ) ;
3+ var is = require ( 'hast-util-is-element' )
54
6- /* Expose. */
7- module . exports = sectioning ;
5+ module . exports = sectioning
86
9- /* Tag-names. */
10- var names = [
11- 'article' ,
12- 'aside' ,
13- 'nav' ,
14- 'section'
15- ] ;
7+ var names = [ 'article' , 'aside' , 'nav' , 'section' ]
168
179/* Check if a node is a sectioning element */
1810function sectioning ( node ) {
19- return is ( node , names ) ;
11+ return is ( node , names )
2012}
Original file line number Diff line number Diff line change 2727 "browserify" : " ^16.0.0" ,
2828 "esmangle" : " ^1.0.1" ,
2929 "nyc" : " ^12.0.0" ,
30+ "prettier" : " ^1.13.5" ,
3031 "remark-cli" : " ^5.0.0" ,
3132 "remark-preset-wooorm" : " ^4.0.0" ,
3233 "tape" : " ^4.4.0" ,
3334 "xo" : " ^0.21.0"
3435 },
3536 "scripts" : {
36- "build-md " : " remark . --quiet --frail --output " ,
37+ "format " : " remark . -qfo && prettier --write '**/*.js' && xo --fix " ,
3738 "build-bundle" : " browserify index.js --bare -s hastUtilSectioning > hast-util-sectioning.js" ,
3839 "build-mangle" : " esmangle hast-util-sectioning.js > hast-util-sectioning.min.js" ,
39- "build" : " npm run build-md && npm run build-bundle && npm run build-mangle" ,
40- "lint" : " xo" ,
41- "test-api" : " node test.js" ,
40+ "build" : " npm run build-bundle && npm run build-mangle" ,
41+ "test-api" : " node test" ,
4242 "test-coverage" : " nyc --reporter lcov tape test.js" ,
43- "test" : " npm run build && npm run lint && npm run test-coverage"
43+ "test" : " npm run format && npm run build && npm run test-coverage"
44+ },
45+ "prettier" : {
46+ "tabWidth" : 2 ,
47+ "useTabs" : false ,
48+ "singleQuote" : true ,
49+ "bracketSpacing" : false ,
50+ "semi" : false ,
51+ "trailingComma" : " none"
4452 },
4553 "xo" : {
46- "space " : true ,
54+ "prettier " : true ,
4755 "esnext" : false ,
4856 "ignores" : [
4957 " hast-util-is-element.js"
Original file line number Diff line number Diff line change @@ -13,24 +13,26 @@ npm install hast-util-sectioning
1313## Usage
1414
1515``` javascript
16- var sectioning = require (' hast-util-sectioning' );
16+ var sectioning = require (' hast-util-sectioning' )
1717
1818sectioning ({
1919 type: ' element' ,
2020 tagName: ' a' ,
2121 properties: {href: ' #alpha' , title: ' Bravo' },
2222 children: [{type: ' text' , value: ' Charlie' }]
23- }); // => false
23+ }) // => false
2424
2525sectioning ({
2626 type: ' element' ,
2727 tagName: ' article' ,
28- children: [{
29- type: ' element' ,
30- tagName: ' p' ,
31- children: [{type: ' text' , value: ' Delta' }]
32- }]
33- }); // => true
28+ children: [
29+ {
30+ type: ' element' ,
31+ tagName: ' p' ,
32+ children: [{type: ' text' , value: ' Delta' }]
33+ }
34+ ]
35+ }) // => true
3436```
3537
3638## API
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ 'use strict'
22
3- var test = require ( 'tape' ) ;
4- var sectioning = require ( '.' ) ;
3+ var test = require ( 'tape' )
4+ var sectioning = require ( '.' )
55
6- test ( 'sectioning' , function ( t ) {
7- t . equal (
8- sectioning ( ) ,
9- false ,
10- 'should return `false` without node'
11- ) ;
6+ test ( 'sectioning' , function ( t ) {
7+ t . equal ( sectioning ( ) , false , 'should return `false` without node' )
128
13- t . equal (
14- sectioning ( null ) ,
15- false ,
16- 'should return `false` with `null`'
17- ) ;
9+ t . equal ( sectioning ( null ) , false , 'should return `false` with `null`' )
1810
1911 t . equal (
2012 sectioning ( { type : 'text' } ) ,
2113 false ,
2214 'should return `false` when without `element`'
23- ) ;
15+ )
2416
2517 t . equal (
2618 sectioning ( { type : 'element' } ) ,
2719 false ,
2820 'should return `false` when with invalid `element`'
29- ) ;
21+ )
3022
3123 t . equal (
3224 sectioning ( {
@@ -37,21 +29,23 @@ test('sectioning', function (t) {
3729 } ) ,
3830 false ,
3931 'should return `false` when without not sectioning'
40- ) ;
32+ )
4133
4234 t . equal (
4335 sectioning ( {
4436 type : 'element' ,
4537 tagName : 'article' ,
46- children : [ {
47- type : 'element' ,
48- tagName : 'p' ,
49- children : [ { type : 'text' , value : 'Delta' } ]
50- } ]
38+ children : [
39+ {
40+ type : 'element' ,
41+ tagName : 'p' ,
42+ children : [ { type : 'text' , value : 'Delta' } ]
43+ }
44+ ]
5145 } ) ,
5246 true ,
5347 'should return `true` when with sectioning'
54- ) ;
48+ )
5549
56- t . end ( ) ;
57- } ) ;
50+ t . end ( )
51+ } )
You can’t perform that action at this time.
0 commit comments