+18
-1
@@ -18,2 +18,18 @@ import { Node } from "domhandler"; | ||
| /** | ||
| * Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags. | ||
| * | ||
| * @deprecated Use `textContent` instead. | ||
| * @param node Node to get the inner text of. | ||
| * @returns `node`'s inner text. | ||
| */ | ||
| export declare function getText(node: Node | Node[]): string; | ||
| /** | ||
| * Get a node's text content. | ||
| * | ||
| * @param node Node to get the text content of. | ||
| * @returns `node`'s text content. | ||
| * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent} | ||
| */ | ||
| export declare function textContent(node: Node | Node[]): string; | ||
| /** | ||
| * Get a node's inner text. | ||
@@ -23,4 +39,5 @@ * | ||
| * @returns `node`'s inner text. | ||
| * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText} | ||
| */ | ||
| export declare function getText(node: Node | Node[]): string; | ||
| export declare function innerText(node: Node | Node[]): string; | ||
| //# sourceMappingURL=stringify.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../src/stringify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,IAAI,EAAE,MAAM,YAAY,CAAC;AACvE,OAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAElE;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,EACnB,OAAO,CAAC,EAAE,oBAAoB,GAC/B,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,oBAAoB,GAC/B,MAAM,CAIR;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,CAMnD"} | ||
| {"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../src/stringify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,IAAI,EAAE,MAAM,YAAY,CAAC;AACvE,OAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGlE;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,EACnB,OAAO,CAAC,EAAE,oBAAoB,GAC/B,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,oBAAoB,GAC/B,MAAM,CAIR;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,CAMnD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,CAMvD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,CAQrD"} |
+43
-2
@@ -6,5 +6,6 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getText = exports.getInnerHTML = exports.getOuterHTML = void 0; | ||
| exports.innerText = exports.textContent = exports.getText = exports.getInnerHTML = exports.getOuterHTML = void 0; | ||
| var domhandler_1 = require("domhandler"); | ||
| var dom_serializer_1 = __importDefault(require("dom-serializer")); | ||
| var domelementtype_1 = require("domelementtype"); | ||
| /** | ||
@@ -33,4 +34,5 @@ * @param node Node to get the outer HTML of. | ||
| /** | ||
| * Get a node's inner text. | ||
| * Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags. | ||
| * | ||
| * @deprecated Use `textContent` instead. | ||
| * @param node Node to get the inner text of. | ||
@@ -51,1 +53,40 @@ * @returns `node`'s inner text. | ||
| exports.getText = getText; | ||
| /** | ||
| * Get a node's text content. | ||
| * | ||
| * @param node Node to get the text content of. | ||
| * @returns `node`'s text content. | ||
| * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent} | ||
| */ | ||
| function textContent(node) { | ||
| if (Array.isArray(node)) | ||
| return node.map(textContent).join(""); | ||
| if (domhandler_1.isTag(node)) | ||
| return textContent(node.children); | ||
| if (domhandler_1.isCDATA(node)) | ||
| return textContent(node.children); | ||
| if (domhandler_1.isText(node)) | ||
| return node.data; | ||
| return ""; | ||
| } | ||
| exports.textContent = textContent; | ||
| /** | ||
| * Get a node's inner text. | ||
| * | ||
| * @param node Node to get the inner text of. | ||
| * @returns `node`'s inner text. | ||
| * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText} | ||
| */ | ||
| function innerText(node) { | ||
| if (Array.isArray(node)) | ||
| return node.map(innerText).join(""); | ||
| if (domhandler_1.hasChildren(node) && node.type === domelementtype_1.ElementType.Tag) { | ||
| return innerText(node.children); | ||
| } | ||
| if (domhandler_1.isCDATA(node)) | ||
| return innerText(node.children); | ||
| if (domhandler_1.isText(node)) | ||
| return node.data; | ||
| return ""; | ||
| } | ||
| exports.innerText = innerText; |
+5
-5
| { | ||
| "name": "domutils", | ||
| "version": "2.6.0", | ||
| "version": "2.7.0", | ||
| "description": "Utilities for working with htmlparser2's dom", | ||
@@ -45,3 +45,3 @@ "author": "Felix Boehm <me@feedic.com>", | ||
| "@types/jest": "^26.0.0", | ||
| "@types/node": "^14.0.5", | ||
| "@types/node": "^15.0.1", | ||
| "@typescript-eslint/eslint-plugin": "^4.1.0", | ||
@@ -52,7 +52,7 @@ "@typescript-eslint/parser": "^4.1.0", | ||
| "eslint-config-prettier": "^8.1.0", | ||
| "eslint-plugin-jsdoc": "^32.0.2", | ||
| "eslint-plugin-jsdoc": "^35.1.0", | ||
| "htmlparser2": "~6.1.0", | ||
| "jest": "^26.0.1", | ||
| "jest": "^27.0.1", | ||
| "prettier": "^2.0.5", | ||
| "ts-jest": "^26.0.0", | ||
| "ts-jest": "^27.0.1", | ||
| "typedoc": "^0.20.5", | ||
@@ -59,0 +59,0 @@ "typescript": "^4.0.2" |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
47531
4.86%1033
5.95%