🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

domelementtype

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domelementtype - npm Package Compare versions

Comparing version
2.3.0
to
3.0.0
+48
dist/index.d.ts
/** Types of elements found in htmlparser2's DOM */
export declare enum ElementType {
/** Type for the root element of a document */
Root = "root",
/** Type for Text */
Text = "text",
/** Type for <? ... ?> */
Directive = "directive",
/** Type for <!-- ... --> */
Comment = "comment",
/** Type for <script> tags */
Script = "script",
/** Type for <style> tags */
Style = "style",
/** Type for Any tag */
Tag = "tag",
/** Type for <![CDATA[ ... ]]> */
CDATA = "cdata",
/** Type for <!doctype ...> */
Doctype = "doctype"
}
/**
* Tests whether an element is a tag or not.
* @param element Element to test
* @param element.type Node type discriminator to check.
*/
export declare function isTag(element: {
type: ElementType;
}): boolean;
/** Type for the root element of a document */
export declare const Root: ElementType.Root;
/** Type for Text */
export declare const Text: ElementType.Text;
/** Type for <? ... ?> */
export declare const Directive: ElementType.Directive;
/** Type for <!-- ... --> */
export declare const Comment: ElementType.Comment;
/** Type for <script> tags */
export declare const Script: ElementType.Script;
/** Type for <style> tags */
export declare const Style: ElementType.Style;
/** Type for Any tag */
export declare const Tag: ElementType.Tag;
/** Type for <![CDATA[ ... ]]> */
export declare const CDATA: ElementType.CDATA;
/** Type for <!doctype ...> */
export declare const Doctype: ElementType.Doctype;
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,oBAAY,WAAW;IACnB,8CAA8C;IAC9C,IAAI,SAAS;IACb,oBAAoB;IACpB,IAAI,SAAS;IACb,yBAAyB;IACzB,SAAS,cAAc;IACvB,4BAA4B;IAC5B,OAAO,YAAY;IACnB,6BAA6B;IAC7B,MAAM,WAAW;IACjB,4BAA4B;IAC5B,KAAK,UAAU;IACf,uBAAuB;IACvB,GAAG,QAAQ;IACX,iCAAiC;IACjC,KAAK,UAAU;IACf,8BAA8B;IAC9B,OAAO,YAAY;CACtB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAM7D;AAGD,8CAA8C;AAE9C,eAAO,MAAM,IAAI,EAAE,WAAW,CAAC,IAAuB,CAAC;AACvD,oBAAoB;AAEpB,eAAO,MAAM,IAAI,EAAE,WAAW,CAAC,IAAuB,CAAC;AACvD,yBAAyB;AAEzB,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,SAAiC,CAAC;AACtE,4BAA4B;AAE5B,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,OAA6B,CAAC;AAChE,6BAA6B;AAE7B,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,MAA2B,CAAC;AAC7D,4BAA4B;AAE5B,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,KAAyB,CAAC;AAC1D,uBAAuB;AAEvB,eAAO,MAAM,GAAG,EAAE,WAAW,CAAC,GAAqB,CAAC;AACpD,iCAAiC;AAEjC,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,KAAyB,CAAC;AAC1D,8BAA8B;AAE9B,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,OAA6B,CAAC"}
/** Types of elements found in htmlparser2's DOM */
export var ElementType;
(function (ElementType) {
/** Type for the root element of a document */
ElementType["Root"] = "root";
/** Type for Text */
ElementType["Text"] = "text";
/** Type for <? ... ?> */
ElementType["Directive"] = "directive";
/** Type for <!-- ... --> */
ElementType["Comment"] = "comment";
/** Type for <script> tags */
ElementType["Script"] = "script";
/** Type for <style> tags */
ElementType["Style"] = "style";
/** Type for Any tag */
ElementType["Tag"] = "tag";
/** Type for <![CDATA[ ... ]]> */
ElementType["CDATA"] = "cdata";
/** Type for <!doctype ...> */
ElementType["Doctype"] = "doctype";
})(ElementType || (ElementType = {}));
/**
* Tests whether an element is a tag or not.
* @param element Element to test
* @param element.type Node type discriminator to check.
*/
export function isTag(element) {
return (element.type === ElementType.Tag ||
element.type === ElementType.Script ||
element.type === ElementType.Style);
}
// Exports for backwards compatibility
/** Type for the root element of a document */
// eslint-disable-next-line prefer-destructuring
export const Root = ElementType.Root;
/** Type for Text */
// eslint-disable-next-line prefer-destructuring
export const Text = ElementType.Text;
/** Type for <? ... ?> */
// eslint-disable-next-line prefer-destructuring
export const Directive = ElementType.Directive;
/** Type for <!-- ... --> */
// eslint-disable-next-line prefer-destructuring
export const Comment = ElementType.Comment;
/** Type for <script> tags */
// eslint-disable-next-line prefer-destructuring
export const Script = ElementType.Script;
/** Type for <style> tags */
// eslint-disable-next-line prefer-destructuring
export const Style = ElementType.Style;
/** Type for Any tag */
// eslint-disable-next-line prefer-destructuring
export const Tag = ElementType.Tag;
/** Type for <![CDATA[ ... ]]> */
// eslint-disable-next-line prefer-destructuring
export const CDATA = ElementType.CDATA;
/** Type for <!doctype ...> */
// eslint-disable-next-line prefer-destructuring
export const Doctype = ElementType.Doctype;
+28
-23
{
"type": "module",
"name": "domelementtype",
"version": "2.3.0",
"version": "3.0.0",
"description": "all the types of nodes in htmlparser2's dom",

@@ -14,11 +15,12 @@ "author": "Felix Boehm <me@feedic.com>",

"sideEffects": false,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"module": "lib/esm/index.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"require": "./lib/index.js",
"import": "./lib/esm/index.js"
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"files": [
"lib/**/*"
"dist/**/*"
],

@@ -35,22 +37,25 @@ "repository": {

],
"engines": {
"node": ">=20.19.0"
},
"scripts": {
"test": "npm run lint && prettier --check **/*.{ts,json,md}",
"lint": "eslint src",
"format": "prettier --write **/*.{ts,json,md}",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc",
"build:esm": "tsc --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json",
"prepare": "npm run build"
"build": "tsc",
"format": "npm run format:es && npm run format:biome",
"format:biome": "biome check --write .",
"format:es": "npm run lint:es -- --fix",
"lint": "npm run lint:es && npm run lint:biome",
"lint:biome": "biome check .",
"lint:es": "eslint .",
"prepare": "npm run build",
"test": "npm run lint"
},
"prettier": {
"tabWidth": 4
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"prettier": "^2.6.2",
"typescript": "^4.6.3"
"@biomejs/biome": "^2.4.4",
"@eslint/compat": "^2.0.2",
"@feedic/eslint-config": "^0.2.3",
"eslint": "^10.0.1",
"eslint-config-biome": "^2.1.3",
"typescript": "^5.7.2",
"typescript-eslint": "^8.56.0"
}
}
/** Types of elements found in htmlparser2's DOM */
export declare enum ElementType {
/** Type for the root element of a document */
Root = "root",
/** Type for Text */
Text = "text",
/** Type for <? ... ?> */
Directive = "directive",
/** Type for <!-- ... --> */
Comment = "comment",
/** Type for <script> tags */
Script = "script",
/** Type for <style> tags */
Style = "style",
/** Type for Any tag */
Tag = "tag",
/** Type for <![CDATA[ ... ]]> */
CDATA = "cdata",
/** Type for <!doctype ...> */
Doctype = "doctype"
}
/**
* Tests whether an element is a tag or not.
*
* @param elem Element to test
*/
export declare function isTag(elem: {
type: ElementType;
}): boolean;
/** Type for the root element of a document */
export declare const Root = ElementType.Root;
/** Type for Text */
export declare const Text = ElementType.Text;
/** Type for <? ... ?> */
export declare const Directive = ElementType.Directive;
/** Type for <!-- ... --> */
export declare const Comment = ElementType.Comment;
/** Type for <script> tags */
export declare const Script = ElementType.Script;
/** Type for <style> tags */
export declare const Style = ElementType.Style;
/** Type for Any tag */
export declare const Tag = ElementType.Tag;
/** Type for <![CDATA[ ... ]]> */
export declare const CDATA = ElementType.CDATA;
/** Type for <!doctype ...> */
export declare const Doctype = ElementType.Doctype;
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,oBAAY,WAAW;IACnB,8CAA8C;IAC9C,IAAI,SAAS;IACb,oBAAoB;IACpB,IAAI,SAAS;IACb,yBAAyB;IACzB,SAAS,cAAc;IACvB,4BAA4B;IAC5B,OAAO,YAAY;IACnB,6BAA6B;IAC7B,MAAM,WAAW;IACjB,4BAA4B;IAC5B,KAAK,UAAU;IACf,uBAAuB;IACvB,GAAG,QAAQ;IACX,iCAAiC;IACjC,KAAK,UAAU;IACf,8BAA8B;IAC9B,OAAO,YAAY;CACtB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAM1D;AAGD,8CAA8C;AAC9C,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,oBAAoB;AACpB,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,yBAAyB;AACzB,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,4BAA4B;AAC5B,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAC3C,6BAA6B;AAC7B,eAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,4BAA4B;AAC5B,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,uBAAuB;AACvB,eAAO,MAAM,GAAG,kBAAkB,CAAC;AACnC,iCAAiC;AACjC,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,8BAA8B;AAC9B,eAAO,MAAM,OAAO,sBAAsB,CAAC"}
/** Types of elements found in htmlparser2's DOM */
export var ElementType;
(function (ElementType) {
/** Type for the root element of a document */
ElementType["Root"] = "root";
/** Type for Text */
ElementType["Text"] = "text";
/** Type for <? ... ?> */
ElementType["Directive"] = "directive";
/** Type for <!-- ... --> */
ElementType["Comment"] = "comment";
/** Type for <script> tags */
ElementType["Script"] = "script";
/** Type for <style> tags */
ElementType["Style"] = "style";
/** Type for Any tag */
ElementType["Tag"] = "tag";
/** Type for <![CDATA[ ... ]]> */
ElementType["CDATA"] = "cdata";
/** Type for <!doctype ...> */
ElementType["Doctype"] = "doctype";
})(ElementType || (ElementType = {}));
/**
* Tests whether an element is a tag or not.
*
* @param elem Element to test
*/
export function isTag(elem) {
return (elem.type === ElementType.Tag ||
elem.type === ElementType.Script ||
elem.type === ElementType.Style);
}
// Exports for backwards compatibility
/** Type for the root element of a document */
export const Root = ElementType.Root;
/** Type for Text */
export const Text = ElementType.Text;
/** Type for <? ... ?> */
export const Directive = ElementType.Directive;
/** Type for <!-- ... --> */
export const Comment = ElementType.Comment;
/** Type for <script> tags */
export const Script = ElementType.Script;
/** Type for <style> tags */
export const Style = ElementType.Style;
/** Type for Any tag */
export const Tag = ElementType.Tag;
/** Type for <![CDATA[ ... ]]> */
export const CDATA = ElementType.CDATA;
/** Type for <!doctype ...> */
export const Doctype = ElementType.Doctype;
{"type":"module"}
/** Types of elements found in htmlparser2's DOM */
export declare enum ElementType {
/** Type for the root element of a document */
Root = "root",
/** Type for Text */
Text = "text",
/** Type for <? ... ?> */
Directive = "directive",
/** Type for <!-- ... --> */
Comment = "comment",
/** Type for <script> tags */
Script = "script",
/** Type for <style> tags */
Style = "style",
/** Type for Any tag */
Tag = "tag",
/** Type for <![CDATA[ ... ]]> */
CDATA = "cdata",
/** Type for <!doctype ...> */
Doctype = "doctype"
}
/**
* Tests whether an element is a tag or not.
*
* @param elem Element to test
*/
export declare function isTag(elem: {
type: ElementType;
}): boolean;
/** Type for the root element of a document */
export declare const Root = ElementType.Root;
/** Type for Text */
export declare const Text = ElementType.Text;
/** Type for <? ... ?> */
export declare const Directive = ElementType.Directive;
/** Type for <!-- ... --> */
export declare const Comment = ElementType.Comment;
/** Type for <script> tags */
export declare const Script = ElementType.Script;
/** Type for <style> tags */
export declare const Style = ElementType.Style;
/** Type for Any tag */
export declare const Tag = ElementType.Tag;
/** Type for <![CDATA[ ... ]]> */
export declare const CDATA = ElementType.CDATA;
/** Type for <!doctype ...> */
export declare const Doctype = ElementType.Doctype;
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,oBAAY,WAAW;IACnB,8CAA8C;IAC9C,IAAI,SAAS;IACb,oBAAoB;IACpB,IAAI,SAAS;IACb,yBAAyB;IACzB,SAAS,cAAc;IACvB,4BAA4B;IAC5B,OAAO,YAAY;IACnB,6BAA6B;IAC7B,MAAM,WAAW;IACjB,4BAA4B;IAC5B,KAAK,UAAU;IACf,uBAAuB;IACvB,GAAG,QAAQ;IACX,iCAAiC;IACjC,KAAK,UAAU;IACf,8BAA8B;IAC9B,OAAO,YAAY;CACtB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAM1D;AAGD,8CAA8C;AAC9C,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,oBAAoB;AACpB,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,yBAAyB;AACzB,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,4BAA4B;AAC5B,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAC3C,6BAA6B;AAC7B,eAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,4BAA4B;AAC5B,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,uBAAuB;AACvB,eAAO,MAAM,GAAG,kBAAkB,CAAC;AACnC,iCAAiC;AACjC,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,8BAA8B;AAC9B,eAAO,MAAM,OAAO,sBAAsB,CAAC"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0;
/** Types of elements found in htmlparser2's DOM */
var ElementType;
(function (ElementType) {
/** Type for the root element of a document */
ElementType["Root"] = "root";
/** Type for Text */
ElementType["Text"] = "text";
/** Type for <? ... ?> */
ElementType["Directive"] = "directive";
/** Type for <!-- ... --> */
ElementType["Comment"] = "comment";
/** Type for <script> tags */
ElementType["Script"] = "script";
/** Type for <style> tags */
ElementType["Style"] = "style";
/** Type for Any tag */
ElementType["Tag"] = "tag";
/** Type for <![CDATA[ ... ]]> */
ElementType["CDATA"] = "cdata";
/** Type for <!doctype ...> */
ElementType["Doctype"] = "doctype";
})(ElementType = exports.ElementType || (exports.ElementType = {}));
/**
* Tests whether an element is a tag or not.
*
* @param elem Element to test
*/
function isTag(elem) {
return (elem.type === ElementType.Tag ||
elem.type === ElementType.Script ||
elem.type === ElementType.Style);
}
exports.isTag = isTag;
// Exports for backwards compatibility
/** Type for the root element of a document */
exports.Root = ElementType.Root;
/** Type for Text */
exports.Text = ElementType.Text;
/** Type for <? ... ?> */
exports.Directive = ElementType.Directive;
/** Type for <!-- ... --> */
exports.Comment = ElementType.Comment;
/** Type for <script> tags */
exports.Script = ElementType.Script;
/** Type for <style> tags */
exports.Style = ElementType.Style;
/** Type for Any tag */
exports.Tag = ElementType.Tag;
/** Type for <![CDATA[ ... ]]> */
exports.CDATA = ElementType.CDATA;
/** Type for <!doctype ...> */
exports.Doctype = ElementType.Doctype;