domutils
Advanced tools
Comparing version 2.4.4 to 2.5.0
@@ -9,3 +9,3 @@ import type { Node, Element, NodeWithChildren, DataNode } from "domhandler"; | ||
* @param node Node to check. | ||
* @returns `true` if the node is a `NodeWithChildren`, `false` otherwise. | ||
* @returns `true` if the node has the type `CDATA`, `false` otherwise. | ||
*/ | ||
@@ -15,3 +15,3 @@ export declare function isCDATA(node: Node): node is NodeWithChildren; | ||
* @param node Node to check. | ||
* @returns `true` if the node is a `DataNode`, `false` otherwise. | ||
* @returns `true` if the node has the type `Text`, `false` otherwise. | ||
*/ | ||
@@ -21,3 +21,3 @@ export declare function isText(node: Node): node is DataNode; | ||
* @param node Node to check. | ||
* @returns `true` if the node is a `DataNode`, `false` otherwise. | ||
* @returns `true` if the node has the type `Comment`, `false` otherwise. | ||
*/ | ||
@@ -24,0 +24,0 @@ export declare function isComment(node: Node): node is DataNode; |
@@ -15,3 +15,3 @@ "use strict"; | ||
* @param node Node to check. | ||
* @returns `true` if the node is a `NodeWithChildren`, `false` otherwise. | ||
* @returns `true` if the node has the type `CDATA`, `false` otherwise. | ||
*/ | ||
@@ -24,3 +24,3 @@ function isCDATA(node) { | ||
* @param node Node to check. | ||
* @returns `true` if the node is a `DataNode`, `false` otherwise. | ||
* @returns `true` if the node has the type `Text`, `false` otherwise. | ||
*/ | ||
@@ -33,3 +33,3 @@ function isText(node) { | ||
* @param node Node to check. | ||
* @returns `true` if the node is a `DataNode`, `false` otherwise. | ||
* @returns `true` if the node has the type `Comment`, `false` otherwise. | ||
*/ | ||
@@ -36,0 +36,0 @@ function isComment(node) { |
@@ -52,2 +52,9 @@ import type { Node, Element, NodeWithChildren } from "domhandler"; | ||
export declare function nextElementSibling(elem: Node): Element | null; | ||
/** | ||
* Returns the previous element sibling of a node. | ||
* | ||
* @param elem The element to get the previous sibling of. | ||
* @returns `elem`'s previous sibling that is a tag. | ||
*/ | ||
export declare function prevElementSibling(elem: Node): Element | null; | ||
//# sourceMappingURL=traversal.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0; | ||
exports.prevElementSibling = exports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0; | ||
var tagtypes_1 = require("./tagtypes"); | ||
@@ -104,1 +104,15 @@ var emptyArray = []; | ||
exports.nextElementSibling = nextElementSibling; | ||
/** | ||
* Returns the previous element sibling of a node. | ||
* | ||
* @param elem The element to get the previous sibling of. | ||
* @returns `elem`'s previous sibling that is a tag. | ||
*/ | ||
function prevElementSibling(elem) { | ||
var _a; | ||
var prev = elem.prev; | ||
while (prev !== null && !tagtypes_1.isTag(prev)) | ||
(_a = prev, prev = _a.prev); | ||
return prev; | ||
} | ||
exports.prevElementSibling = prevElementSibling; |
{ | ||
"name": "domutils", | ||
"version": "2.4.4", | ||
"version": "2.5.0", | ||
"description": "Utilities for working with htmlparser2's dom", | ||
"author": "Felix Boehm <me@feedic.com>", | ||
"funding": "https://github.com/fb55/domutils?sponsor=1", | ||
"funding": { | ||
"url": "https://github.com/fb55/domutils?sponsor=1" | ||
}, | ||
"license": "BSD-2-Clause", | ||
@@ -18,3 +20,3 @@ "sideEffects": false, | ||
"lint": "npm run lint:es && npm run lint:prettier", | ||
"lint:es": "eslint .", | ||
"lint:es": "eslint --ignore-path .gitignore .", | ||
"lint:prettier": "npm run prettier -- --check", | ||
@@ -24,5 +26,5 @@ "format": "npm run format:es && npm run format:prettier", | ||
"format:prettier": "npm run prettier -- --write", | ||
"prettier": "prettier '**/*.{ts,md,json,yml}'", | ||
"prettier": "prettier \"**/*.{ts,md,json,yml}\" --ignore-path .gitignore", | ||
"build": "tsc", | ||
"update-docs": "typedoc --out docs --exclude src/index.ts --readme none --excludeNotExported --excludePrivate --excludeProtected --excludeExternals --hideGenerator", | ||
"build:docs": "typedoc --hideGenerator --exclude \"**/*+(index|.spec).ts\" src", | ||
"prepare": "npm run build" | ||
@@ -50,10 +52,9 @@ }, | ||
"eslint": "^7.0.0", | ||
"eslint-config-prettier": "^7.0.0", | ||
"eslint-plugin-jsdoc": "^30.6.3", | ||
"htmlparser2": "~5.0.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-jsdoc": "^32.0.2", | ||
"htmlparser2": "~6.0.0", | ||
"jest": "^26.0.1", | ||
"prettier": "^2.0.5", | ||
"ts-jest": "^26.0.0", | ||
"typedoc": "^0.19.1", | ||
"typedoc-plugin-markdown": "^3.0.2", | ||
"typedoc": "^0.20.5", | ||
"typescript": "^4.0.2" | ||
@@ -60,0 +61,0 @@ }, |
@@ -1,7 +0,18 @@ | ||
Utilities for working with htmlparser2's dom | ||
# domutils [![Build Status](https://travis-ci.com/fb55/domutils.svg?branch=master)](https://travis-ci.com/fb55/domutils) | ||
[![Build Status](https://travis-ci.com/fb55/domutils.svg?branch=master)](https://travis-ci.com/fb55/domutils) | ||
Utilities for working with [htmlparser2](https://github.com/fb55/htmlparser2)'s DOM. | ||
[Documentation:](docs/README.md) All functions are exported as a single module. Look through the docs to see what is available. | ||
All functions are exported as a single module. Look [through the docs](https://domutils.js.org/modules.html) to see what is available. | ||
## Ecosystem | ||
| Name | Description | | ||
| ------------------------------------------------------------- | ------------------------------------------------------- | | ||
| [htmlparser2](https://github.com/fb55/htmlparser2) | Fast & forgiving HTML/XML parser | | ||
| [domhandler](https://github.com/fb55/domhandler) | Handler for htmlparser2 that turns documents into a DOM | | ||
| [domutils](https://github.com/fb55/domutils) | Utilities for working with domhandler's DOM | | ||
| [css-select](https://github.com/fb55/css-select) | CSS selector engine, compatible with domhandler's DOM | | ||
| [cheerio](https://github.com/cheeriojs/cheerio) | The jQuery API for domhandler's DOM | | ||
| [dom-serializer](https://github.com/cheeriojs/dom-serializer) | Serializer for domhandler's DOM | | ||
--- | ||
@@ -8,0 +19,0 @@ |
Sorry, the diff of this file is not supported yet
47232
14
1038
32