hast-util-is-event-handler

hast utility to check if a property is an event handler

Usage no npm install needed!

<script type="module">
  import hastUtilIsEventHandler from 'https://cdn.skypack.dev/hast-util-is-event-handler';
</script>

README

hast-util-is-event-handler

Build Coverage Downloads Size Sponsors Backers Chat

Check if a property is an event handler.

Install

This package is ESM only: Node 12+ is needed to use it and it must be importeded instead of requiredd.

npm:

npm install hast-util-is-event-handler

This package exports the following identifiers: isEventHandler. There is no default export.

Use

import {isEventHandler} from 'hast-util-is-event-handler'

isEventHandler('oncut') //=> true
isEventHandler('onpushsubscriptionchange') //=> true
isEventHandler('ones') //=> false
isEventHandler('class') //=> false

API

isEventHandler(prop)

Check if prop is a string starting with 'on' and its length is 5 or more.

Contribute

See contributing.md in rehypejs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer