Class: H_generics

H_generics

Utility class for basic type and object operations.
Provides static methods for type checking, object manipulation, and utility helpers.
and sometimes little functions just to make the code easier to read and undeerstand.
Used as h.libs.generics.

In generics.js, you'll find also H_math, and H_strings, two small classes containing generics method
for math and strings.

new H_generics()

generics.js, line 26

Methods

staticH_generics.copy_object(a, b)

generics.js, line 47
Copies all properties from object a to object b.
Name Type Description
a Object Source object.
b Object Target object.

staticH_generics.execute_function_by_name(function_name, context, args){*}

generics.js, line 269
Executes a function by its name in a given context.
Supports nested namespaces and array access.
Name Type Description
function_name string Name of the function (can be namespaced).
context Object Context object.
args * repeatable Arguments to pass to the function.
Returns:
Type Description
* Function result.

staticH_generics.get_type(a){string}

generics.js, line 225
Returns the type of a variable as a string.
Name Type Description
a * Value to check.
Returns:
Type Description
string Type name.

staticH_generics.get_unique_id(){number}

generics.js, line 58
Returns a unique incremental ID.
Used a lot for html elements without IDs or objects.
Returns:
Type Description
number Unique ID.

staticH_generics.is_array(a){boolean}

generics.js, line 147
Checks if a variable is an array.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if array.

staticH_generics.is_dom_object(a){boolean}

generics.js, line 94
Checks if a variable is a DOM object.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if DOM object.

staticH_generics.is_empty(a){boolean}

generics.js, line 81
Checks if a variable is empty.
Works for arrays, objects, and false values.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if empty.

staticH_generics.is_event(a){boolean}

generics.js, line 156
Checks if a variable is an Event object.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if Event.

staticH_generics.is_file(a){boolean}

generics.js, line 208
Checks if a variable is a File object.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if File.

staticH_generics.is_file_list(a){boolean}

generics.js, line 216
Checks if a variable is a FileList object.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if FileList.

staticH_generics.is_filled_array(a){boolean|number}

generics.js, line 165
Checks if an array is filled (not empty).
Name Type Description
a * Value to check.
Returns:
Type Description
boolean | number Length if filled, false otherwise.

staticH_generics.is_filled_object(a){boolean|number}

generics.js, line 177
Checks if an object is filled (has keys).
Name Type Description
a * Value to check.
Returns:
Type Description
boolean | number Number of keys if filled, false otherwise.

staticH_generics.is_formdata(a){boolean}

generics.js, line 110
Checks if a variable is a FormData object.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if FormData.

staticH_generics.is_function(a){boolean}

generics.js, line 128
Checks if a variable is a function.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if function.

staticH_generics.is_numeric(a){boolean}

generics.js, line 199
Checks if a variable is numeric. just because it's more readable than !isNaN(x)
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if numeric.

staticH_generics.is_object(a){boolean}

generics.js, line 68
Checks if a variable is an object.
shortcut more readable than test with "typeof"
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if object.

staticH_generics.is_property(a){boolean}

generics.js, line 138
Checks if a variable is a property (not a function, null, or undefined).
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if property.

staticH_generics.is_string(a){boolean}

generics.js, line 119
Checks if a variable is a string.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if string.

staticH_generics.is_undefined(a){boolean}

generics.js, line 189
Checks if a variable is undefined.
Name Type Description
a * Value to check.
Returns:
Type Description
boolean True if undefined.

staticH_generics.merge_objects(a, b){Object}

generics.js, line 237
Merges two objects into a new object. Properties from b override those from a.
Name Type Description
a Object First object.
b Object Second object.
Returns:
Type Description
Object Merged object.