File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed
Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -4,19 +4,12 @@ var visit = require('unist-util-visit')
44
55module . exports = shiftHeading
66
7- var floor = Math . floor
8- var min = 1
9- var max = 6
10-
11- // Character codes.
12- var digit0 = 48
13-
147function shiftHeading ( tree , shift ) {
158 if (
169 typeof shift !== 'number' ||
1710 ! shift ||
1811 ! isFinite ( shift ) ||
19- floor ( shift ) !== shift
12+ Math . floor ( shift ) !== shift
2013 ) {
2114 throw new Error ( 'Expected a non-null finite integer, not `' + shift + '`' )
2215 }
@@ -37,8 +30,8 @@ function shiftHeading(tree, shift) {
3730 name === 'h5' ||
3831 name === 'h6'
3932 ) {
40- rank = name . charCodeAt ( 1 ) - digit0 + shift
41- node . tagName = 'h' + ( rank > max ? max : rank < min ? min : rank )
33+ rank = name . charCodeAt ( 1 ) - 48 /* `0` */ + shift
34+ node . tagName = 'h' + ( rank > 6 ? 6 : rank < 1 ? 1 : rank )
4235 }
4336 }
4437}
You can’t perform that action at this time.
0 commit comments