{"id":18961642,"url":"https://github.com/trialanderrororg/xast-util-is-element","last_synced_at":"2025-06-13T13:07:29.330Z","repository":{"id":130692365,"uuid":"607887962","full_name":"TrialAndErrorOrg/xast-util-is-element","owner":"TrialAndErrorOrg","description":"Port of [hast-util-is-element](https://github.com/syntax-tree/hast-util-has-property) for [xast][xast]","archived":false,"fork":false,"pushed_at":"2024-06-28T18:51:39.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-25T20:45:45.436Z","etag":null,"topics":["hast","unified","xast"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TrialAndErrorOrg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-28T21:58:16.000Z","updated_at":"2023-03-09T23:54:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f1c79c4-bebc-4107-b1a1-8a5bd09c15b4","html_url":"https://github.com/TrialAndErrorOrg/xast-util-is-element","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/TrialAndErrorOrg/xast-util-is-element","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fxast-util-is-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fxast-util-is-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fxast-util-is-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fxast-util-is-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrialAndErrorOrg","download_url":"https://codeload.github.com/TrialAndErrorOrg/xast-util-is-element/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fxast-util-is-element/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259650958,"owners_count":22890385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hast","unified","xast"],"created_at":"2024-11-08T14:13:50.077Z","updated_at":"2025-06-13T13:07:29.289Z","avatar_url":"https://github.com/TrialAndErrorOrg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e **Note**\n\u003e This repository is automatically generated from the [main parser monorepo](https://github.com/TrialAndErrorOrg/parsers). Please submit any issues or pull requests there.\n\n# xast-util-is-element\n\n[![npm version](https://badge.fury.io/js/xast-util-is-element.svg)](https://badge.fury.io/js/xast-util-is-element) [![npm downloads](https://img.shields.io/npm/dm/xast-util-is-element.svg)](https://www.npmjs.com/package/xast-util-is-element)\n\nPort of [hast-util-is-element](https://github.com/syntax-tree/hast-util-has-property) for [xast][xast]\n\n## Contents\n\n*   [xast-util-is-element](#xast-util-is-element)\n    *   [Contents](#contents)\n    *   [What is this?](#what-is-this)\n    *   [When should I use this?](#when-should-i-use-this)\n    *   [Install](#install)\n    *   [Use](#use)\n    *   [API](#api)\n    *   [Syntax tree](#syntax-tree)\n    *   [Types](#types)\n    *   [Compatibility](#compatibility)\n    *   [Security](#security)\n    *   [Related](#related)\n    *   [Contribute](#contribute)\n    *   [License](#license)\n\n## What is this?\n\n## When should I use this?\n\n## Install\n\nThis package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install as\n\n```bash\npnpm add xast-util-is-element\n# or with yarn\n# yarn add xast-util-is-element\n# or with npm\n# npm install xast-util-is-element\n```\n\n## Use\n\n## API\n\n***\n\n### `convertElement()`\n\n#### Signature\n\n```ts\nconvertElement\u003cT\u003e(test: T[\"name\"] | TestFunctionPredicate\u003cT\u003e): AssertPredicate\u003cT\u003e;\n```\n\n#### Type parameters\n\n*   `T` *extends* `Element`\u003c`T`\u003e\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `test` | `T`[`\"name\"`] | [`TestFunctionPredicate`](modules.md#testfunctionpredicate)\u003c`T`\u003e |\n\n#### Returns\n\n[`AssertPredicate`](modules.md#assertpredicate)\u003c`T`\u003e\n\nDefined in:  [lib/xast-util-is-element.ts:174](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L174)\n\n#### Signature\n\n```ts\nconvertElement(test?: Test): AssertAnything;\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `test?` | [`Test`](modules.md#test) |\n\n#### Returns\n\n[`AssertAnything`](modules.md#assertanything)\n\nDefined in:  [lib/xast-util-is-element.ts:177](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L177)\n\n***\n\n### `isElement()`\n\n#### Signature\n\n```ts\nisElement(): false;\n```\n\n#### Returns\n\n`false`\n\nDefined in:  [lib/xast-util-is-element.ts:123](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L123)\n\n#### Signature\n\n```ts\nisElement\u003cT\u003e(\n  node: unknown, \n  test?: PredicateTest\u003cT\u003e, \n  index?: number, \n  parent?: Parent\u003cNode\u003cData\u003e, Data\u003e, \n  context?: unknown): node is T;\n```\n\n#### Type parameters\n\n*   `T` *extends* `Element`\u003c`T`\u003e = `Element`\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `node` | `unknown` |\n| `test?` | [`PredicateTest`](modules.md#predicatetest)\u003c`T`\u003e |\n| `index?` | `number` |\n| `parent?` | `Parent`\u003c`Node`\u003c`Data`\u003e, `Data`\u003e |\n| `context?` | `unknown` |\n\n#### Returns\n\n`node is T`\n\nDefined in:  [lib/xast-util-is-element.ts:124](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L124)\n\n#### Signature\n\n```ts\nisElement(\n  node: unknown, \n  test: Test, \n  index?: number, \n  parent?: Parent\u003cNode\u003cData\u003e, Data\u003e, \n  context?: unknown): boolean;\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `node` | `unknown` |\n| `test` | [`Test`](modules.md#test) |\n| `index?` | `number` |\n| `parent?` | `Parent`\u003c`Node`\u003c`Data`\u003e, `Data`\u003e |\n| `context?` | `unknown` |\n\n#### Returns\n\n`boolean`\n\nDefined in:  [lib/xast-util-is-element.ts:131](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L131)\n\n***\n\n### `AssertAnything`\n\n\u003e `Function`\n\n#### Type declaration\n\nCheck if a node is an element and passes a certain node test\n\n##### `Signature`\n\n```ts\n(node?: unknown, index?: number | null, parent?: Parent | null): boolean;\n```\n\n##### `Parameters`\n\n| Name | Type |\n| :------ | :------ |\n| `node?` | `unknown` |\n| `index?` | `number` | `null` |\n| `parent?` | `Parent` | `null` |\n\n##### `Returns`\n\n`boolean`\n\nDefined in:  [lib/xast-util-is-element.ts:40](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L40)\n\n***\n\n### `AssertPredicate`\n\n\u003e \u003c`Y`\u003e `Function`\n\n#### Type parameters\n\n*   `Y` *extends* `Element`\n\n#### Type declaration\n\nCheck if a node is an element and passes a certain node test\n\n##### `Signature`\n\n```ts\n(node?: unknown, index?: number | null, parent?: Parent | null): node is Y;\n```\n\n##### `Parameters`\n\n| Name | Type |\n| :------ | :------ |\n| `node?` | `unknown` |\n| `index?` | `number` | `null` |\n| `parent?` | `Parent` | `null` |\n\n##### `Returns`\n\n`node is Y`\n\nDefined in:  [lib/xast-util-is-element.ts:50](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L50)\n\n***\n\n### `Name`\n\n\u003e `string`\n\nDefined in:  [lib/xast-util-is-element.ts:4](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L4)\n\n***\n\n### `PredicateTest`\n\n\u003e \u003c`T`\u003e `null` | `undefined` | `T`[`\"name\"`] | [`TestFunctionPredicate`](modules.md#testfunctionpredicate)\u003c`T`\u003e | (`T`[`\"name\"`] | [`TestFunctionPredicate`](modules.md#testfunctionpredicate)\u003c`T`\u003e)[]\n\n#### Type parameters\n\n*   `T` *extends* `Element`\n\nDefined in:  [lib/xast-util-is-element.ts:12](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L12)\n\n***\n\n### `Test`\n\n\u003e `null` | `undefined` | [`Name`](modules.md#name) | [`TestFunctionAnything`](modules.md#testfunctionanything) | ([`Name`](modules.md#name) | [`TestFunctionAnything`](modules.md#testfunctionanything))[]\n\nDefined in:  [lib/xast-util-is-element.ts:5](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L5)\n\n***\n\n### `TestFunctionAnything`\n\n\u003e `Function`\n\n#### Type declaration\n\nCheck if an element passes a test\n\n##### `Signature`\n\n```ts\n(element: Element, index?: number | null, parent?: Parent | null): boolean | void;\n```\n\n##### `Parameters`\n\n| Name | Type |\n| :------ | :------ |\n| `element` | `Element` |\n| `index?` | `number` | `null` |\n| `parent?` | `Parent` | `null` |\n\n##### `Returns`\n\n`boolean` | `void`\n\nDefined in:  [lib/xast-util-is-element.ts:22](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L22)\n\n***\n\n### `TestFunctionPredicate`\n\n\u003e \u003c`X`\u003e `Function`\n\n#### Type parameters\n\n*   `X` *extends* `Element`\n\n#### Type declaration\n\nCheck if an element passes a certain node test\n\n##### `Signature`\n\n```ts\n(element: Element, index?: number | null, parent?: Parent | null): element is X;\n```\n\n##### `Parameters`\n\n| Name | Type |\n| :------ | :------ |\n| `element` | `Element` |\n| `index?` | `number` | `null` |\n| `parent?` | `Parent` | `null` |\n\n##### `Returns`\n\n`element is X`\n\nDefined in:  [lib/xast-util-is-element.ts:31](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/xast/xast-util-is-element/src/lib/xast-util-is-element.ts#L31)\n\n## Syntax tree\n\n## Types\n\n## Compatibility\n\n## Security\n\n## Related\n\n## Contribute\n\n## License\n\n[MIT](LICENSE) © Thomas F. K. Jorna\n\n[unified]: https://unifiedjs.com\n\n[unifiedgh]: https://github.com/unifiedjs/unified\n\n[xast-from-xml]: https://github.com/syntax-tree/xast-util-from-xml\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour\n\n[rejour-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-parse\n\n[rejour-stringify]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-stringify\n\n[rejour-move-abstract]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-move-abstract\n\n[rejour-meta]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-meta\n\n[rejour-relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-relatex\n\n[relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex\n\n[relatex-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/relatex-parse\n\n[jast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast\n\n[jast-util-to-texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast-util-to-texast\n\n[jastscript]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jastscript\n\n[texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast\n\n[texast-util-to-latex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast-util-to-latex\n\n[hast]: https://github.com/syntax-tree/hast\n\n[xast]: https://github.com/syntax-tree/xast\n\n[mdast]: https://github.com/syntax-tree/mdast\n\n[mdast-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[latex-utensils]: https://github.com/tamuratak/latex-utensils\n\n[latexjs]: https://github.com/latexjs/latexjs\n\n[reoff]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff\n\n[reoff-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-parse\n\n[reoff-rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-rejour\n\n[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast\n\n[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast-util-to-jast\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrialanderrororg%2Fxast-util-is-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrialanderrororg%2Fxast-util-is-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrialanderrororg%2Fxast-util-is-element/lists"}