diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:05:55 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:05:55 +0800 |
| commit | c06f7ee0a40255214c477e13d9b956a7e07c2900 (patch) | |
| tree | f5982a568ef8fab865d0142e71c7494fea3e4c1b /node_modules/domutils/lib/querying.d.ts | |
| parent | 3fd9400d4dccc25aa29b5702216732e0b7542073 (diff) | |
postcss,(plugins): nanocss, postcss-preset-env
Diffstat (limited to 'node_modules/domutils/lib/querying.d.ts')
| -rw-r--r-- | node_modules/domutils/lib/querying.d.ts | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/node_modules/domutils/lib/querying.d.ts b/node_modules/domutils/lib/querying.d.ts new file mode 100644 index 00000000..630531db --- /dev/null +++ b/node_modules/domutils/lib/querying.d.ts @@ -0,0 +1,64 @@ +import { Element, AnyNode } from "domhandler"; +/** + * Search a node and its children for nodes passing a test function. If `node` is not an array, it will be wrapped in one. + * + * @category Querying + * @param test Function to test nodes on. + * @param node Node to search. Will be included in the result set if it matches. + * @param recurse Also consider child nodes. + * @param limit Maximum number of nodes to return. + * @returns All nodes passing `test`. + */ +export declare function filter(test: (elem: AnyNode) => boolean, node: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[]; +/** + * Search an array of nodes and their children for nodes passing a test function. + * + * @category Querying + * @param test Function to test nodes on. + * @param nodes Array of nodes to search. + * @param recurse Also consider child nodes. + * @param limit Maximum number of nodes to return. + * @returns All nodes passing `test`. + */ +export declare function find(test: (elem: AnyNode) => boolean, nodes: AnyNode[], recurse: boolean, limit: number): AnyNode[]; +/** + * Finds the first element inside of an array that matches a test function. This is an alias for `Array.prototype.find`. + * + * @category Querying + * @param test Function to test nodes on. + * @param nodes Array of nodes to search. + * @returns The first node in the array that passes `test`. + * @deprecated Use `Array.prototype.find` directly. + */ +export declare function findOneChild<T>(test: (elem: T) => boolean, nodes: T[]): T | undefined; +/** + * Finds one element in a tree that passes a test. + * + * @category Querying + * @param test Function to test nodes on. + * @param nodes Node or array of nodes to search. + * @param recurse Also consider child nodes. + * @returns The first node that passes `test`. + */ +export declare function findOne(test: (elem: Element) => boolean, nodes: AnyNode[], recurse?: boolean): Element | null; +/** + * Checks if a tree of nodes contains at least one node passing a test. + * + * @category Querying + * @param test Function to test nodes on. + * @param nodes Array of nodes to search. + * @returns Whether a tree of nodes contains at least one node passing the test. + */ +export declare function existsOne(test: (elem: Element) => boolean, nodes: AnyNode[]): boolean; +/** + * Search an array of nodes and their children for elements passing a test function. + * + * Same as `find`, but limited to elements and with less options, leading to reduced complexity. + * + * @category Querying + * @param test Function to test nodes on. + * @param nodes Array of nodes to search. + * @returns All nodes passing `test`. + */ +export declare function findAll(test: (elem: Element) => boolean, nodes: AnyNode[]): Element[]; +//# sourceMappingURL=querying.d.ts.map
\ No newline at end of file |
