Skip to content

Commit 30b583f

Browse files
committed
Refactor to move implementation to lib/
1 parent d81cdd4 commit 30b583f

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

index.js

+1-31
Original file line numberDiff line numberDiff line change
@@ -1,31 +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 embedded content.
9-
*
10-
* @type {import('hast-util-is-element').AssertPredicate<Element & {tagName: 'audio' | 'canvas' | 'embed' | 'iframe' | 'img' | 'math' | 'object' | 'picture' | 'svg' | 'video'}>}
11-
* @param value
12-
* Thing to check (typically `Node`).
13-
* @returns
14-
* Whether `value` is an element considered embedded content.
15-
*
16-
* The elements `audio`, `canvas`, `embed`, `iframe`, `img`, `math`,
17-
* `object`, `picture`, `svg`, and `video` are embedded content.
18-
*/
19-
// @ts-expect-error Sure, the assertion matches.
20-
export const embedded = convertElement([
21-
'audio',
22-
'canvas',
23-
'embed',
24-
'iframe',
25-
'img',
26-
'math',
27-
'object',
28-
'picture',
29-
'svg',
30-
'video'
31-
])
1+
export {embedded} from './lib/index.js'

lib/index.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 embedded content.
9+
*
10+
* @type {import('hast-util-is-element').AssertPredicate<Element & {tagName: 'audio' | 'canvas' | 'embed' | 'iframe' | 'img' | 'math' | 'object' | 'picture' | 'svg' | 'video'}>}
11+
* @param value
12+
* Thing to check (typically `Node`).
13+
* @returns
14+
* Whether `value` is an element considered embedded content.
15+
*
16+
* The elements `audio`, `canvas`, `embed`, `iframe`, `img`, `math`,
17+
* `object`, `picture`, `svg`, and `video` are embedded content.
18+
*/
19+
// @ts-expect-error Sure, the assertion matches.
20+
export const embedded = convertElement([
21+
'audio',
22+
'canvas',
23+
'embed',
24+
'iframe',
25+
'img',
26+
'math',
27+
'object',
28+
'picture',
29+
'svg',
30+
'video'
31+
])

package.json

+1
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)