You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
22 KiB
JavaScript

9 months ago
"use strict";
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
exports.id = "vendor-chunks/hast-util-is-element";
exports.ids = ["vendor-chunks/hast-util-is-element"];
exports.modules = {
/***/ "(ssr)/./node_modules/hast-util-is-element/index.js":
/*!****************************************************!*\
!*** ./node_modules/hast-util-is-element/index.js ***!
\****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ convertElement: () => (/* binding */ convertElement),\n/* harmony export */ isElement: () => (/* binding */ isElement)\n/* harmony export */ });\n/**\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('hast').Element} Element\n */ /**\n * @typedef {null | undefined | string | TestFunctionAnything | Array<string | TestFunctionAnything>} Test\n * Check for an arbitrary element, unaware of TypeScript inferral.\n *\n * @callback TestFunctionAnything\n * Check if an element passes a test, unaware of TypeScript inferral.\n * @param {Element} element\n * An element.\n * @param {number | null | undefined} [index]\n * The elements position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The elements parent.\n * @returns {boolean | void}\n * Whether this element passes the test.\n */ /**\n * @template {Element} T\n * Element type.\n * @typedef {T['tagName'] | TestFunctionPredicate<T> | Array<T['tagName'] | TestFunctionPredicate<T>>} PredicateTest\n * Check for an element that can be inferred by TypeScript.\n */ /**\n * Check if an element passes a certain node test.\n *\n * @template {Element} T\n * Element type.\n * @callback TestFunctionPredicate\n * Complex test function for an element that can be inferred by TypeScript.\n * @param {Element} element\n * An element.\n * @param {number | null | undefined} [index]\n * The elements position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The elements parent.\n * @returns {element is T}\n * Whether this element passes the test.\n */ /**\n * @callback AssertAnything\n * Check that an arbitrary value is an element, unaware of TypeScript inferral.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The nodes position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The nodes parent.\n * @returns {boolean}\n * Whether this is an element and passes a test.\n */ /**\n * Check if a node is an element and passes a certain node test\n *\n * @template {Element} T\n * Element type.\n * @callback AssertPredicate\n * Check that an arbitrary value is a specific element, aware of TypeScript.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The nodes position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The nodes parent.\n * @returns {node is T}\n * Whether this is an element and passes a test.\n */ /**\n * Check if `node` is an `Element` and whether it passes the given test.\n *\n * @param node\n * Thing to check, typically `Node`.\n * @param test\n * A check for a specific element.\n * @param index\n * The nodes position in its parent.\n * @param parent\n * The nodes parent.\n * @returns\n * Whether `node` is an element and passes a test.\n */ const isElement = /**\n * @type {(\n * (() => false) &\n * (<T extends Element = Element>(node: unknown, test?: PredicateTest<T>, index?: number, parent?: Parent, context?: unknown) => node is T) &\n * ((node: unknown, test: Test, index?: number, parent?: Parent, context?: unknown) => boolean)\n * )}\n */ /**\n * @param {unknown} [node]\n * @param {Test | undefined} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */ // eslint-disable-next-line max-params\nfunction(node, test, index, parent, context) {\n const check = convertElement(test);\n if (index !== undefined && index !== null && (typeof index !== \"number\" || index < 0 || index === Number.POSITIVE_INFINITY)) {\n throw new Error(\"Expected positive finite index for child node\");\n }\n if (parent !== undefined && parent !== null && (!parent.type || !parent.children)) {\n throw new
/***/ })
};
;