Skip to content

Commit 72e3613

Browse files
committed
Refactor to move implementation to lib/
1 parent 8c362f1 commit 72e3613

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

index.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1 @@
1-
/**
2-
* @typedef {import('hast').Element} Element
3-
*/
4-
5-
import {convertElement} from 'hast-util-is-element'
6-
7-
/**
8-
* Check if a node is a heading element (includes `hgroup`!).
9-
*
10-
* @type {import('hast-util-is-element').AssertPredicate<Element & {tagName: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'hgroup'}>}
11-
* @param node
12-
* Node to check.
13-
* @returns
14-
* Whether node is a heading (`h1` through `h6`, and `hgroup`).
15-
*/
16-
// @ts-expect-error Sure, the assertion matches.
17-
export const heading = convertElement([
18-
'h1',
19-
'h2',
20-
'h3',
21-
'h4',
22-
'h5',
23-
'h6',
24-
'hgroup'
25-
])
1+
export {heading} from './lib/index.js'

lib/index.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @typedef {import('hast').Element} Element
3+
*/
4+
5+
import {convertElement} from 'hast-util-is-element'
6+
7+
/**
8+
* Check if a node is a heading element (includes `hgroup`!).
9+
*
10+
* @type {import('hast-util-is-element').AssertPredicate<Element & {tagName: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'hgroup'}>}
11+
* @param node
12+
* Node to check.
13+
* @returns
14+
* Whether node is a heading (`h1` through `h6`, and `hgroup`).
15+
*/
16+
// @ts-expect-error Sure, the assertion matches.
17+
export const heading = convertElement([
18+
'h1',
19+
'h2',
20+
'h3',
21+
'h4',
22+
'h5',
23+
'h6',
24+
'hgroup'
25+
])

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"main": "index.js",
2929
"types": "index.d.ts",
3030
"files": [
31+
"lib/",
3132
"index.d.ts",
3233
"index.js"
3334
],

0 commit comments

Comments
 (0)