hast-util-is-element
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -7,2 +7,3 @@ /** | ||
* @typedef {string} TagName | ||
* @typedef {null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>} Test | ||
*/ | ||
@@ -59,8 +60,3 @@ /** | ||
node?: unknown, | ||
test?: | ||
| null | ||
| undefined | ||
| TagName | ||
| TestFunctionAnything | ||
| Array<TagName | TestFunctionAnything>, | ||
test?: Test, | ||
index?: number, | ||
@@ -73,10 +69,3 @@ parent?: Parent, | ||
) => AssertPredicate<T>) & | ||
(( | ||
test?: | ||
| null | ||
| undefined | ||
| TagName | ||
| TestFunctionAnything | ||
| Array<TagName | TestFunctionAnything> | ||
) => AssertAnything) | ||
((test?: Test) => AssertAnything) | ||
export type Node = import('unist').Node | ||
@@ -86,2 +75,8 @@ export type Parent = import('unist').Parent | ||
export type TagName = string | ||
export type Test = | ||
| null | ||
| undefined | ||
| TagName | ||
| TestFunctionAnything | ||
| Array<TagName | TestFunctionAnything> | ||
/** | ||
@@ -88,0 +83,0 @@ * Check if an element passes a test |
10
index.js
@@ -7,2 +7,3 @@ /** | ||
* @typedef {string} TagName | ||
* @typedef {null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>} Test | ||
*/ | ||
@@ -60,3 +61,3 @@ | ||
* (<T extends Element>(node: unknown, test: T['tagName']|TestFunctionPredicate<T>|Array.<T['tagName']|TestFunctionPredicate<T>>, index?: number, parent?: Parent, context?: unknown) => node is T) & | ||
* ((node?: unknown, test?: null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>, index?: number, parent?: Parent, context?: unknown) => boolean) | ||
* ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean) | ||
* )} | ||
@@ -70,4 +71,3 @@ */ | ||
* @param {unknown} [node] Node to check | ||
* @param {null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>} [test] | ||
* When nullish, checks if `node` is a `Node`. | ||
* @param {Test} [test] When nullish, checks if `node` is a `Node`. | ||
* When `string`, works like passing `function (node) {return node.type === test}`. | ||
@@ -123,3 +123,3 @@ * When `function` checks if function passed the node is true. | ||
* (<T extends Element>(test: T['tagName']|TestFunctionPredicate<T>) => AssertPredicate<T>) & | ||
* ((test?: null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>) => AssertAnything) | ||
* ((test?: Test) => AssertAnything) | ||
* )} | ||
@@ -130,3 +130,3 @@ */ | ||
* Generate an assertion from a check. | ||
* @param {null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>} [test] | ||
* @param {Test} [test] | ||
* When nullish, checks if `node` is a `Node`. | ||
@@ -133,0 +133,0 @@ * When `string`, works like passing `function (node) {return node.type === test}`. |
{ | ||
"name": "hast-util-is-element", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "hast utility to check if a node is a (certain) element", | ||
@@ -50,3 +50,3 @@ "license": "MIT", | ||
"unified": "^9.0.0", | ||
"xo": "^0.38.0" | ||
"xo": "^0.39.0" | ||
}, | ||
@@ -53,0 +53,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19102
322