Skip to content

TrialAndErrorOrg/xast-util-has-attribute

Repository files navigation

Note This repository is automatically generated from the main parser monorepo. Please submit any issues or pull requests there.

xast-util-has-attribute

npm version npm downloads

Port of hast-util-has-property for xast

Contents

What is this?

When should I use this?

Install

This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install as

pnpm add xast-util-has-attribute
# or with yarn
# yarn add xast-util-has-attribute
# or with npm
# npm install xast-util-has-attribute

Use

API


hasAttribute()

Check if node has a set name property.

Signature

hasAttribute(node: unknown, name: string): boolean;

Parameters

Name Type
node unknown
name string

Returns

boolean

Defined in: lib/xast-util-has-attribute.ts:10

Syntax tree

Types

Compatibility

Security

Related

Contribute

License

MIT © Thomas F. K. Jorna