@tylertech/forge-core 3.3.0-dev.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/utils.d.ts +8 -0
- package/dist/utils/utils.js +22 -0
- package/package.json +2 -2
package/dist/utils/utils.d.ts
CHANGED
|
@@ -56,6 +56,14 @@ export declare function isArray(obj: any): boolean;
|
|
|
56
56
|
* @returns {boolean}
|
|
57
57
|
*/
|
|
58
58
|
export declare function isObject(obj: any): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Safely checks if an object is an HTMLElement instance.
|
|
61
|
+
* Works in both browser environments and environments where HTMLElement might not be
|
|
62
|
+
* a proper constructor (e.g. Node-based testing environments).
|
|
63
|
+
* @param {any} obj - The object to check.
|
|
64
|
+
* @returns {boolean}
|
|
65
|
+
*/
|
|
66
|
+
export declare function isHTMLElement(obj: any): obj is HTMLElement;
|
|
59
67
|
/**
|
|
60
68
|
* Coerces a string to a boolean.
|
|
61
69
|
* @param {string} value The value to convert.
|
package/dist/utils/utils.js
CHANGED
|
@@ -87,6 +87,28 @@ export function isArray(obj) {
|
|
|
87
87
|
export function isObject(obj) {
|
|
88
88
|
return obj instanceof Object;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Safely checks if an object is an HTMLElement instance.
|
|
92
|
+
* Works in both browser environments and environments where HTMLElement might not be
|
|
93
|
+
* a proper constructor (e.g. Node-based testing environments).
|
|
94
|
+
* @param {any} obj - The object to check.
|
|
95
|
+
* @returns {boolean}
|
|
96
|
+
*/
|
|
97
|
+
export function isHTMLElement(obj) {
|
|
98
|
+
if (typeof HTMLElement === 'function') {
|
|
99
|
+
try {
|
|
100
|
+
return obj instanceof HTMLElement;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// instanceof can throw if rights-hand side is not available in the environment, fall through to duck-typing
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return (typeof obj === 'object' &&
|
|
107
|
+
obj !== null &&
|
|
108
|
+
typeof obj.nodeType === 'number' &&
|
|
109
|
+
typeof obj.nodeName === 'string' &&
|
|
110
|
+
(typeof obj.localName === 'string' || typeof obj.tagName === 'string'));
|
|
111
|
+
}
|
|
90
112
|
/**
|
|
91
113
|
* Coerces a string to a boolean.
|
|
92
114
|
* @param {string} value The value to convert.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tylertech/forge-core",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "A library of core web utilities that support Tyler Forge™ based libraries.",
|
|
5
5
|
"author": "Tyler Technologies, Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"tslib": "^2.8.1"
|
|
31
31
|
},
|
|
32
|
-
"publishedAt": "2026-
|
|
32
|
+
"publishedAt": "2026-05-14T20:28:02.184Z"
|
|
33
33
|
}
|