Skip to content

Commit 075e725

Browse files
committed
Change to remove support for non-nodes
1 parent 5088642 commit 075e725

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

lib/index.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,18 @@ const meta = convertElement('meta')
6262
/**
6363
* Check if the given value is *phrasing* content.
6464
*
65-
* @param {unknown} value
66-
* Thing to check, typically `Node`.
65+
* @param {Nodes} value
66+
* Node to check.
6767
* @returns {boolean}
6868
* Whether `value` is phrasing content.
6969
*/
7070
export function phrasing(value) {
7171
return Boolean(
72-
node(value) &&
73-
(value.type === 'text' ||
74-
basic(value) ||
75-
embedded(value) ||
76-
// @ts-expect-error: To do: update `hast-util-is-body-ok-link` in `rehype-minify`.
77-
isBodyOkLink(value) ||
78-
(meta(value) && hasProperty(value, 'itemProp')))
72+
value.type === 'text' ||
73+
basic(value) ||
74+
embedded(value) ||
75+
// @ts-expect-error: To do: update `hast-util-is-body-ok-link` in `rehype-minify`.
76+
isBodyOkLink(value) ||
77+
(meta(value) && hasProperty(value, 'itemProp'))
7978
)
8079
}
81-
82-
/**
83-
* @param {unknown} value
84-
* @returns {value is Nodes}
85-
*/
86-
function node(value) {
87-
// @ts-expect-error: looks like an object.
88-
return value && typeof value === 'object' && 'type' in value
89-
}

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ Check if the given value is [*phrasing*][spec] content.
105105

106106
###### Parameters
107107

108-
* `value` (`unknown`)
109-
thing to check, typically [`Node`][node]
108+
* `value` ([`Node`][node])
109+
node to check
110110

111111
###### Returns
112112

0 commit comments

Comments
 (0)