[@acaldas/document-model-libs](../README.md) / [Exports](../modules.md) / Document

# Namespace: Document

This module exports all the public types, functions, and objects
from the document module. It provides an easy-to-use interface
for managing documents, and can be used in any Redux-based
application. This module exports:
- All action creators for the base document actions.
- The Document object, which is used to for creating and
manipulating documents in an object-oriented way.
- The baseReducer function, which is a reducer for managing
documents
- Various utility functions to be used by Document Models.

## Namespaces

- [actions](Document.actions.md)
- [utils](Document.utils.md)

## Classes

- [BaseDocument](../classes/Document.BaseDocument.md)

## Functions

### applyMixins

▸ **applyMixins**(`derivedCtor`, `constructors`): `void`

Applies multiple mixins to a base class.
Used to have separate mixins to group methods by actions.

**`Remarks`**

[https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern](https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern)

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `derivedCtor` | `any` | The class to apply the mixins to. |
| `constructors` | `any`[] | The constructors of the mixins. |

#### Returns

`void`

#### Defined in

[src/document/object.ts:183](https://github.com/acaldas/document-model-libs/blob/8be7e70/src/document/object.ts#L183)

___

### baseReducer

▸ **baseReducer**<`T`, `A`\>(`state`, `action`, `customReducer`): `Document`<`T`, `A`\>

Base document reducer that wraps a custom document reducer and handles
document-level actions such as undo, redo, prune, and set name.

#### Type parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `T` | `T` | The type of the state of the custom reducer. |
| `A` | extends `Action`<`string`\> | The type of the actions of the custom reducer. |

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `state` | `Document`<`T`, `A`\> | The current state of the document. |
| `action` | `BaseAction` \| `A` | The action object to apply to the state. |
| `customReducer` | `ImmutableReducer`<`T`, `A`\> | The custom reducer that implements the application logic specific to the document's state. |

#### Returns

`Document`<`T`, `A`\>

The new state of the document.

#### Defined in

[src/document/reducer.ts:157](https://github.com/acaldas/document-model-libs/blob/8be7e70/src/document/reducer.ts#L157)
