# Utils

Utils is a collection of static helper functions provided by the FhyTS framework to simplify object manipulation and validation in various contexts, such as configuration merging, data type validation, and more.

## API Reference

#### Utils.isObject(obj: any): boolean

Checks whether the given value is a regular object (not an array and not null).

* **Parameter**: obj — any value to check.
* **Return**: true if obj is a valid object, false otherwise

**Example Usage**:

```javascript
import { Utils } from 'fhyts';

console.log(Utils.isObject({}));         // true
console.log(Utils.isObject([]));         // false
console.log(Utils.isObject(null));       // false
console.log(Utils.isObject('text'));     // false
```

#### Utils.merge(target: any, source: any): any

Recursively merges properties from source to target. Suitable for merging configurations within an application.

Parameters:

* Target — the object to modify.
* Source — the source object to merge.

Return:

* The merged object with updated or added properties from source.

Usage Examples:

```javascript
import { Utils } from 'fhyts';

const defaults = {
  debug: false,
  server: { port: 3000, host: 'localhost' }
};

const overrides = {
  debug: true,
  server: { port: 8080 }
};

const config = Utils.merge(defaults, overrides);
// config = { debug: true, server: { port: 8080, host: 'localhost' } }
```

## Note

* **Utils.merge()** performs a deep merge, not a shallow merge.
* **Utils.isObject()** is useful for validation before manipulating object properties in dynamic functions.

## Next

Once you understand how Utils works, you can move on to the [Database](#database) section to learn how the framework handles integration and abstraction of data access using the models you've defined.