UNPKG

1.34 kBTypeScriptView Raw
1/** @file Types used in signatures of Cheerio methods. */
2type LowercaseLetters = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
3type AlphaNumeric = LowercaseLetters | Uppercase<LowercaseLetters> | `${number}`;
4type SelectorSpecial = '.' | '#' | ':' | '|' | '>' | '+' | '~' | '[';
5/**
6 * Type for identifying selectors. Allows us to "upgrade" queries using
7 * selectors to return `Element`s.
8 */
9export type SelectorType = `${SelectorSpecial}${AlphaNumeric}${string}` | `${AlphaNumeric}${string}`;
10import type { Cheerio } from './cheerio.js';
11import type { AnyNode } from 'domhandler';
12/** Elements that can be passed to manipulation methods. */
13export type BasicAcceptedElems<T extends AnyNode> = ArrayLike<T> | T | string;
14/** Elements that can be passed to manipulation methods, including functions. */
15export type AcceptedElems<T extends AnyNode> = BasicAcceptedElems<T> | ((this: T, i: number, el: T) => BasicAcceptedElems<T>);
16/** Function signature, for traversal methods. */
17export type FilterFunction<T> = (this: T, i: number, el: T) => boolean;
18/** Supported filter types, for traversal methods. */
19export type AcceptedFilters<T> = string | FilterFunction<T> | T | Cheerio<T>;
20export {};
21//# sourceMappingURL=types.d.ts.map
\No newline at end of file