Skip to content

Commit

Permalink
refactor: Use tagtypes from domhandler (#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 authored Apr 16, 2021
1 parent 4f7d6eb commit ada2337
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 61 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dependencies": {
"dom-serializer": "^1.0.1",
"domelementtype": "^2.2.0",
"domhandler": "^4.1.0"
"domhandler": "^4.2.0"
},
"devDependencies": {
"@types/jest": "^26.0.0",
Expand Down
3 changes: 1 addition & 2 deletions src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Node } from "domhandler";
import { hasChildren } from "./tagtypes";
import { hasChildren, Node } from "domhandler";

/**
* Given an array of nodes, remove any member that is contained by another.
Expand Down
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ export * from "./manipulation";
export * from "./querying";
export * from "./legacy";
export * from "./helpers";
export * from "./tagtypes";
export {
isTag,
isCDATA,
isText,
isComment,
isDocument,
hasChildren,
} from "domhandler";
3 changes: 1 addition & 2 deletions src/legacy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Node, Element } from "domhandler";
import { isTag, isText, Node, Element } from "domhandler";
import { ElementType } from "domelementtype";
import { filter, findOne } from "./querying";
import { isTag, isText } from "./tagtypes";

type TestType = (elem: Node) => boolean;

Expand Down
3 changes: 1 addition & 2 deletions src/querying.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Node, Element } from "domhandler";
import { isTag, hasChildren } from "./tagtypes";
import { isTag, hasChildren, Node, Element } from "domhandler";

/**
* Search a node and its children for nodes passing a test function.
Expand Down
3 changes: 1 addition & 2 deletions src/stringify.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Node } from "domhandler";
import { isTag, isCDATA, isText, hasChildren } from "./tagtypes";
import { isTag, isCDATA, isText, hasChildren, Node } from "domhandler";
import renderHTML, { DomSerializerOptions } from "dom-serializer";

/**
Expand Down
42 changes: 0 additions & 42 deletions src/tagtypes.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/traversal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Node, Element, NodeWithChildren } from "domhandler";
import { isTag } from "./tagtypes";
import { isTag, Node, Element, NodeWithChildren } from "domhandler";

const emptyArray: Node[] = [];
/**
Expand Down

0 comments on commit ada2337

Please sign in to comment.