Socket
Socket
Sign inDemoInstall

hast-util-is-element

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hast-util-is-element - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

4

index.js

@@ -5,4 +5,4 @@ 'use strict'

/* Check if, whether `tagNames` is given, a node is an element
* or an element matching `tagNames`. */
// Check if if `node` is an `element` and, if `tagNames` is given, `node`
// matches them `tagNames`.
function isElement(node, tagNames) {

@@ -9,0 +9,0 @@ var name

{
"name": "hast-util-is-element",
"version": "1.0.2",
"version": "1.0.3",
"description": "Check if a node is a (certain) element",

@@ -26,12 +26,12 @@ "license": "MIT",

"browserify": "^16.0.0",
"nyc": "^13.0.0",
"prettier": "^1.13.5",
"nyc": "^14.0.0",
"prettier": "^1.0.0",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^4.0.0",
"tape": "^4.4.0",
"tinyify": "^2.4.3",
"xo": "^0.23.0"
"remark-preset-wooorm": "^5.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.24.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s hastUtilIsElement > hast-util-is-element.js",

@@ -38,0 +38,0 @@ "build-mangle": "browserify . -s hastUtilIsElement -p tinyify > hast-util-is-element.min.js",

@@ -1,10 +0,19 @@

# hast-util-is-element [![Build][build-badge]][build] [![Coverage][coverage-badge]][coverage] [![Downloads][downloads-badge]][downloads] [![Chat][chat-badge]][chat]
# hast-util-is-element
Check if a [node][] is a (certain) [**HAST**][hast] [element][].
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
## Installation
[**hast**][hast] utility to check if a [*node*][node] is a (certain)
[*element*][element].
## Install
[npm][]:
```bash
```sh
npm install hast-util-is-element

@@ -15,3 +24,3 @@ ```

```javascript
```js
var is = require('hast-util-is-element')

@@ -30,13 +39,16 @@

Check if a [node][] is a (certain) [**HAST**][hast] [element][].
Check if the given value is a (certain) [*element*][element].
When not given a second parameter, asserts if `node` is an element,
otherwise asserts `node` is an element whose `tagName` matches / is
included in the second parameter.
* When given a `tagName` or `tagNames`, checks that `node` is an
[*element*][element] whose `tagName` field matches `tagName` or is included
in `tagNames`
* Otherwise checks that `node` is an [*element*][element]
###### Parameters
* `node` (`*`) — Value to check;
* `tagName` (`string`, optional) — Value `node`s `tagName` must match;
* `tagNames` (`Array.<string>`, optional) — Value including `node`s `tagName`.
* `node` (`*`) — Value to check, probably [`Node`][node]
* `tagName` (`string`, optional) — Value that `node`s `tagName` field should
match
* `tagNames` (`Array.<string>`, optional) — Values that should include `node`s
`tagName` field should match

@@ -53,7 +65,9 @@ ###### Returns

See [`contributing.md` in `syntax-tree/hast`][contributing] for ways to get
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
started.
See [`support.md`][support] for ways to get help.
This organisation has a [Code of Conduct][coc]. By interacting with this
repository, organisation, or community you agree to abide by its terms.
This project has a [Code of Conduct][coc].
By interacting with this repository, organisation, or community you agree to
abide by its terms.

@@ -78,5 +92,15 @@ ## License

[size-badge]: https://img.shields.io/bundlephobia/minzip/hast-util-is-element.svg
[size]: https://bundlephobia.com/result?p=hast-util-is-element
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
[chat]: https://spectrum.chat/unified/rehype
[chat]: https://spectrum.chat/unified/syntax-tree

@@ -89,2 +113,8 @@ [npm]: https://docs.npmjs.com/cli/install

[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md
[support]: https://github.com/syntax-tree/.github/blob/master/support.md
[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
[hast]: https://github.com/syntax-tree/hast

@@ -95,5 +125,1 @@

[element]: https://github.com/syntax-tree/hast#element
[contributing]: https://github.com/syntax-tree/hast/blob/master/contributing.md
[coc]: https://github.com/syntax-tree/hast/blob/master/code-of-conduct.md
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc