@tylertech/forge-core
Advanced tools
@@ -60,2 +60,10 @@ /** Generates random characters. Defaults to a length of 5. */ | ||
| /** | ||
| * Safely checks if an object is an HTMLElement instance. | ||
| * Works in both browser environments and environments where HTMLElement might not be | ||
| * a proper constructor (e.g. Node-based testing environments). | ||
| * @param {any} obj - The object to check. | ||
| * @returns {boolean} | ||
| */ | ||
| export declare function isHTMLElement(obj: any): obj is HTMLElement; | ||
| /** | ||
| * Coerces a string to a boolean. | ||
@@ -62,0 +70,0 @@ * @param {string} value The value to convert. |
+22
-0
@@ -91,2 +91,24 @@ /** Generates random characters. Defaults to a length of 5. */ | ||
| /** | ||
| * Safely checks if an object is an HTMLElement instance. | ||
| * Works in both browser environments and environments where HTMLElement might not be | ||
| * a proper constructor (e.g. Node-based testing environments). | ||
| * @param {any} obj - The object to check. | ||
| * @returns {boolean} | ||
| */ | ||
| export function isHTMLElement(obj) { | ||
| if (typeof HTMLElement === 'function') { | ||
| try { | ||
| return obj instanceof HTMLElement; | ||
| } | ||
| catch { | ||
| // instanceof can throw if rights-hand side is not available in the environment, fall through to duck-typing | ||
| } | ||
| } | ||
| return (typeof obj === 'object' && | ||
| obj !== null && | ||
| typeof obj.nodeType === 'number' && | ||
| typeof obj.nodeName === 'string' && | ||
| (typeof obj.localName === 'string' || typeof obj.tagName === 'string')); | ||
| } | ||
| /** | ||
| * Coerces a string to a boolean. | ||
@@ -93,0 +115,0 @@ * @param {string} value The value to convert. |
+2
-2
| { | ||
| "name": "@tylertech/forge-core", | ||
| "version": "3.3.0", | ||
| "version": "3.3.1", | ||
| "description": "A library of core web utilities that support Tyler Forge™ based libraries.", | ||
@@ -32,3 +32,3 @@ "author": "Tyler Technologies, Inc.", | ||
| }, | ||
| "publishedAt": "2026-04-02T12:09:51.417Z" | ||
| "publishedAt": "2026-05-14T20:28:02.184Z" | ||
| } |
174759
0.67%4093
0.74%