{"id":18705629,"url":"https://github.com/angular-package/core","last_synced_at":"2025-11-09T06:30:25.072Z","repository":{"id":117698322,"uuid":"111427098","full_name":"angular-package/core","owner":"angular-package","description":"Core features.","archived":false,"fork":false,"pushed_at":"2021-07-28T23:16:22.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T06:41:55.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angular-package.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["angular-package"],"patreon":"sciborrudnicki","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-11-20T15:19:43.000Z","updated_at":"2021-07-28T23:16:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"d49e850a-f668-4cb6-9536-a301d0ffd4d9","html_url":"https://github.com/angular-package/core","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-package%2Fcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-package%2Fcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-package%2Fcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-package%2Fcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angular-package","download_url":"https://codeload.github.com/angular-package/core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239568493,"owners_count":19660690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T12:11:31.435Z","updated_at":"2025-11-09T06:30:24.991Z","avatar_url":"https://github.com/angular-package.png","language":"TypeScript","funding_links":["https://github.com/sponsors/angular-package","https://patreon.com/sciborrudnicki","https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026link=https://github.com/sponsors/angular-package"],"categories":[],"sub_categories":[],"readme":"# Packages\n\nUseful and simple to use packages based on the [angular.io][angulario].\n\n| Package                              | Description                                        | Status                                                       |\n| :----------------------------------- | :------------------------------------------------- | -----------------------------------------------------------: |\n| [change-detection][cd-github-readme] | Improve application performance.                   | [![npm version][cd-npm-badge-svg]][cd-npm-badge]             |\n| [core][core-github-readme]           | Core features.                                     | [![npm version][core-npm-badge-svg]][core-npm-badge]         |\n| [prism][prism-github-readme]         | `Prism` highlighter module.                        | [![npm version][prism-npm-badge-svg]][prism-npm-badge]       |\n| [property][property-github-readme]   | Features to handle object properties.              | [![npm version][property-npm-badge-svg]][property-npm-badge] |\n| [reactive][reactive-github-readme]   | Automatize process of creating some rxjs features. | [![npm version][reactive-npm-badge-svg]][reactive-npm-badge] |\n| [ui][ui-github-readme]               | User interface.                                    | *In Progress*                                                |\n| [type][type-github-readme]           | Common types, type guards and type checkers.       | [![npm version][type-npm-badge-svg]][type-npm-badge]         |\n| [testing][testing-github-readme]     | Support for testing other packages.                | [![npm version][testing-npm-badge-svg]][testing-npm-badge]   |\n\n\u003e Click on the package name to visit the package.\n\n## angular-package/core\n\nCore features.\n\n\u003c!-- npm badge --\u003e\n[![npm version][core-npm-badge-svg]][core-npm-badge]\n\u003c!-- GitHub badges --\u003e\n[![GitHub issues][core-badge-issues]][core-issues]\n[![GitHub forks][core-badge-forks]][core-forks]\n[![GitHub stars][core-badge-stars]][core-stars]\n[![GitHub license][core-badge-license]][core-license]\n\u003c!-- Sponsors badges --\u003e\n[![GitHub sponsors][github-badge-sponsor]][github-sponsor-link]\n[![Support me on Patreon][patreon-badge]][patreon-link]\n\n----\n\n## Table of contents\n\n* [Basic concepts](#basic-concepts)\n* [Skeleton](#skeleton)\n* [Installation](#installation)\n* [Api](#api)\n* Package\n  * [Callback](#callback)\n  * [Component loader](#component-loader)\n  * [Error](#error)\n* [Git](#git)\n  * [Commit](#commit)\n  * [Versioning](#versioning)\n* [License](#license)\n\n----\n\n\u003cbr\u003e\n\n## Basic concepts\n\nChecks\n\u003e It's to check the provided value to be **the same** as **expected**.\n\nType guard (constrain)\n\u003e Constrains the parameter type to **not let** input **unexpected** value in the **code editor**.\n\nGuards\n\u003e It's a **combination** of both above, **constrains** the type of the parameter in the **code editor**, and checks its provided argument.\n\nSets\n\u003e Sets the given value in the `object`.\n\nDefines\n\u003e Returns defined value from the method, instead of storing it in the `object`.\n\n\u003cbr\u003e\n\n## Skeleton\n\nThis package was built by the [library skeleton][skeleton] which was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.1.1.\n\nCopy this package to the `packages/core` folder of the [library skeleton][skeleton] then run the commands below.\n\n### Build\n\nRun `ng build core` to build the package. The build artifacts will be stored in the `dist/` directory.\n\n### Running unit tests\n\nRun `ng test core` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n\u003cbr\u003e\n\n## Installation\n\nInstall `@angular-package/core` package with command:\n\n```bash\nnpm i --save @angular-package/core\n```\n\n\u003cbr\u003e\n\n## Api\n\n```typescript\n/**\n * Callback\n * --------\n * @angular-package/core/callback\n */\nimport {\n  // Class.\n  Callback,\n} from '@angular-package/core';\n```\n\n```typescript\n/**\n * Component loader.\n * --------\n * @angular-package/core/component-loader\n */\nimport {\n  // Class.\n  ComponentLoader,\n} from '@angular-package/core';\n```\n\n```typescript\n/**\n * Error\n * -----\n * @angular-package/core/error\n */\nimport {\n  // Class.\n  ValidationError,\n  // Interface.\n  ErrorMessage,\n} from '@angular-package/core';\n```\n\n\u003cbr\u003e\n\n## Callback\n\n```typescript\n/**\n * Callback\n * --------\n * @angular-package/core/callback\n */\nimport {\n  // Class.\n  Callback,\n} from '@angular-package/core';\n```\n\n### `Callback`\n\nManages the callback [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type.\n\n\u003cbr\u003e\n\n**Static methods:**\n\n| Methods                                                          | Description |\n| :--------------------------------------------------------------- | :---------- |\n| [`Callback.defineCallback()`](#callbackdefinecallback)           | Defines the [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type that contains a [`ResultHandler`](#resulthandler) function to handle the result and the provided value of its check |\n| [`Callback.defineErrorCallback()`](#callbackdefineerrorcallback) | Defines the [`function`][js-function] of [`ResultCallback`][package-type-resultcallback] type to throw [`ValidationError`](#validationerror) with a specified message on a state from the `throwOnState` |\n| [`Callback.guard()`](#callbackguard)                             | Guards the provided `resultCallback` to be [`ResultCallback`][package-type-resultcallback] type |\n| [`Callback.isCallback()`](#callbackiscallback)                   | Checks if the provided `value` is an instance of [`Callback`](#callback) with optional indicating allowed names under which callback functions can be stored |\n\n**Constructor:**\n\n| Constructor                           | Description |\n| :------------------------------------ | :---------- |\n| [`Callback()`](#callback-constructor) | Initialize an instance of a [`Callback`](#callback) with the allowed names under which callback functions can be stored |\n\n**Instance methods:**\n\n| Callback.prototype.                 | Description |\n| :---------------------------------- | :---------- |\n| [`getCallback()`][c-im-1]      | Gets from the storage specified by-name callback [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type |\n| [`setCallback()`][c-im-2]      | Sets the callback [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type to the storage under the given allowed `name` restricted by `AllowNames` |\n| [`setErrorCallback()`][c-im-3] | Sets a [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type to the storage under the given allowed name with the given error message to throw on the specified state from the `throwOnState` |\n\n[c-im-1]: #callbackprototypegetcallback\n[c-im-2]: #callbackprototypesetcallback\n[c-im-3]: #callbackprototypeseterrorcallback\n\n\u003cbr\u003e\n\n### `Callback` static methods\n\n----\n\n### `Callback.defineCallback()`\n\nDefines the [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type that contains a [`ResultHandler`](#resulthandler) function to handle the result and the provided value of its check.\n\n```typescript\nstatic defineCallback(\n  resultHandler: ResultHandler\n): ResultCallback {\n  return (result: boolean, value: any) =\u003e {\n    if (is.function(resultHandler)) {\n      resultHandler(result, value);\n    }\n    return result;\n  };\n}\n```\n\n**Parameters:**\n\n| Name: type                     | Description |\n| :----------------------------- | :---------- |\n| `resultHandler: ResultHandler` | The [`function`][js-function] of [`ResultHandler`](#resulthandler) type to handle the `value` and the `result` of the check |\n\n**Returns:**\n\n| Returns          | Type       | Description  |\n| :--------------- | :--------: | :----------- |\n| `ResultCallback` | `Function` | The **return type** is a [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type |\n\nThe **return value** is a [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type that contains a [`function`][js-function] of [`ResultHandler`](#resulthandler).\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Callback } from '@angular-package/core';\nimport { is } from '@angular-package/type';\n\nconst stringCallback = Callback.defineCallback(\n  (result: boolean, value: any) =\u003e {\n    if (is.false(result)) {\n      console.log(`Something went wrong`);\n    }\n  }\n);\n\nis.string(5, stringCallback);\n```\n\n\u003cbr\u003e\n\n### `Callback.defineErrorCallback()`\n\nDefines the [`function`][js-function] of [`ResultCallback`][package-type-resultcallback] type to throw [`ValidationError`](#validationerror) with a specified message on a state from the `throwOnState`.\n\n```typescript\nstatic defineErrorCallback(\n  message: string | ErrorMessage,\n  throwOnState: boolean = false\n): ResultCallback {\n  return Callback.defineCallback((result: boolean, value: any): void =\u003e {\n    if (is.false(throwOnState) ? is.false(result) : is.true(result)) {\n      throw new ValidationError(message);\n    }\n  });\n}\n```\n\n**Parameters:**\n\n| Name: type                        | Description |\n| :-------------------------------- | :---------- |\n| `message: string \\| ErrorMessage` | The message of string type or [`ErrorMessage`](#errormessage) interface, to throw with an error of [`ValidationError`](#validationerror) |\n| `throwOnState: boolean`           | A state of [`boolean`][js-boolean] type on which an error of [`ValidationError`](#validationerror) should be thrown. By default, it's set to `false` |\n\n**Returns:**\n\n| Returns          | Type       | Description  |\n| :--------------- | :--------: | :----------- |\n| `ResultCallback` | `Function` | The **return type** is a [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type |\n\nThe **return value** is a [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type that throws a [`ValidationError`](#validationerror) on a specified state.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Callback } from '@angular-package/core';\nimport { is } from '@angular-package/type';\n\nconst stringCallback = Callback.defineErrorCallback('Something went wrong');\nis.string(5, stringCallback); // Throws ValidationError: Something went wrong\n```\n\n\u003cbr\u003e\n\n### `Callback.guard()`\n\nGuards the provided `resultCallback` to be [`ResultCallback`][package-type-resultcallback] type.\n\n```typescript\nstatic guard(\n  resultCallback: ResultCallback\n): resultCallback is ResultCallback {\n  return guard.function(resultCallback);\n}\n```\n\n**Parameters:**\n\n| Name: type                       | Description |\n| :------------------------------- | :---------- |\n| `resultCallback: ResultCallback` | The [`function`][js-function] of [`ResultCallback`][package-type-resultcallback], to guard |\n\n**Returns:**\n\n| Returns                            | Type      | Description  |\n| :--------------------------------- | :-------: | :----------- |\n| `resultCallback is ResultCallback` | `boolean` | The **return type** is boolean, as the result of its statement that indicates the provided `resultCallback` is the [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type |\n\nThe **return value** is a boolean indicating whether the provided `resultCallback` parameter is a [`function`][js-function].\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Callback } from '@angular-package/core';\n\nCallback.guard(result =\u003e result); // Returns `true`.\nCallback.guard({} as any); // Returns `false`.\n```\n\n\u003cbr\u003e\n\n### `Callback.isCallback()`\n\nChecks if the provided `value` is an instance of [`Callback`](#callback) with optional indicating allowed names under which callback functions can be stored\n\n```typescript\nstatic isCallback\u003cAllowNames extends string\u003e(\n  value: any,\n  ...allowNames: AllowNames[]\n): value is Callback\u003cAllowNames\u003e {\n  return is.instance(value, Callback);\n}\n```\n\n**Generic type variables:**\n\n| Name                        | Description |\n| :-------------------------- | :---------- |\n| `AllowNames extends string` | A generic variable of `AllowNames` name that is constrained by the [`string`][js-string] type and is used to indicate allowed names under which callback functions can be stored, and is linked with the return type `value is Callback\u003cAllowNames\u003e`. By default, its value is captured from the provided `allowNames` rest parameter  |\n\n**Parameters:**\n\n| Name: type                    | Description |\n| :---------------------------- | :---------- |\n| `value: any`                  | The `value` of any type to check |\n| `...allowNames: AllowNames[]` | A rest parameter of `AllowNames` that indicates allowed names for the `Callback\u003cAllowNames\u003e` return type |\n\n**Returns:**\n\n| Returns                         | Type      | Description |\n| :------------------------------ | :-------: | :---------- |\n| `value is Callback\u003cAllowNames\u003e` | `boolean` | The **return type** is `boolean`, as the result of its statement that indicates the provided `value` is  a [`Callback`](#callback) with allowed names from the provided `allowNames` parameter or generic variable `AllowNames` |\n\nThe **return value** is a `boolean` indicating whether the `value` is an instance of [`Callback`](#callback) .\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Callback } from '@angular-package/core';\n\nCallback.isCallback({}); // Returns `false`\nCallback.isCallback(new Callback()); // Returns `true`\n\nconst callback = new Callback('one', 'two', 'three');\nif (Callback.isCallback(callback)) {\n  callback.setCallback('one', result =\u003e result); // There's no hint on `name` parameter about allowed names.\n}\nif (Callback.isCallback(callback, 'one', 'two')) {\n  callback.setCallback('one', result =\u003e result); // There is a hint from the provided `allowNames` parameter of the `isCallback()` method.\n}\n```\n\n\u003cbr\u003e\n\n### `Callback` constructor\n\n----\n\n### `Callback()`\n\nInitialize an instance of a [`Callback`](#callback) with the allowed names under which callback functions can be stored.\n\n```typescript\nnew Callback\u003cAllowNames extends string\u003e(...allowNames: AllowNames[]) {\n  this.#allowedNames = guard.array(allowNames)\n    ? new Set(allowNames)\n    : this.#allowedNames;\n}\n```\n\n**Generic type variables:**\n\n| Name                          | Description |\n| :---------------------------- | :---------- |\n| `AllowedNames extends string` | A generic variable `AllowNames` that is constrained by the [`string`][js-string] type and is used to **restrict** allowed names under which callback functions can be stored. By default, its value is captured from the provided `allowNames` rest parameter |\n\n**Parameters:**\n\n| Name: type                   | Description |\n| :--------------------------- | :---------- |\n| `allowNames: AllowedNames[]` | A rest parameter of a [`string`][js-string] type allowed names under which callback functions can be stored. Only those names given by this parameter are being checked by the `isNameAllowed()` private method |\n\n**Returns:**\n\nThe **return value** is new instance of a [`Callback`](#callback).\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Callback } from '@angular-package/core';\n\nconst callback = new Callback(['set', 'define']);\n```\n\n\u003cbr\u003e\n\n### `Callback` instance methods\n\n----\n\n### `Callback.prototype.getCallback()`\n\nGets from the storage specified by-name callback [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type.\n\n```typescript\npublic getCallback\u003cName extends AllowNames\u003e(\n  name: Name\n): Pick\u003cCallbackStorage, Name\u003e[Name] {\n  return this.#storage.get(name);\n}\n```\n\n**Generic type variables:**\n\n| Name                      | Description |\n| :------------------------ | :---------- |\n| `Name extends AllowNames` | A generic `Name` variable constrained by the `AllowNames` indicates the name under which callback [`function`][js-function] is picked from the storage. It is linked with the return type `Pick\u003cCallbackStorage, Name\u003e[Name]` that refers exactly to the type, which is [`ResultCallback`][package-type-resultcallback] of the callback [`function`][js-function] picked from the storage with the provided `name`. By default, its value is captured from the provided `name` |\n\n**Parameters:**\n\n| Name: type   | Description |\n| :----------- | :---------- |\n| `name: Name` | A [`string`][js-string] type name that is restricted by the `AllowNames` to pick stored callback [`function`][js-function] |\n\n**Returns:**\n\n| Returns                             | Type       | Description |\n| :---------------------------------- | :--------: | :---------- |\n| `Pick\u003cCallbackStorage, Name\u003e[Name]` | `function` | The **return type** is a [`ResultCallback`][package-type-resultcallback] [`function`][js-function] that is picked from the stored callback [`function`][js-function] of the given `name` |\n\nThe **return value** is the callback `function` of a [`ResultCallback`][package-type-resultcallback] type picked from the storage.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Callback } from '@angular-package/core';\n/**\n * Initialize `Callback`.\n */\nconst callback = new Callback('firstName');\n\ncallback\n  .setCallback('firstName', result =\u003e result) // Set the callback function under the given name.\n  .getCallback('firstName'); // Get the function stored under the given name.\n```\n\n\u003cbr\u003e\n\n### `Callback.prototype.setCallback()`\n\nSets the callback function of a [`ResultCallback`][package-type-resultcallback] type to the storage under the given allowed `name` restricted by `AllowNames`.\n\n```typescript\npublic setCallback\u003cName extends AllowNames\u003e(\n  name: Name,\n  resultHandler: ResultHandler\n): this {\n  if (this.isNameAllowed(name)) {\n    this.#storage.set(name, Callback.defineCallback(resultHandler));\n  }\n  return this;\n}\n```\n\n**Generic type variables:**\n\n| Name                      | Description |\n| :------------------------ | :---------- |\n| `Name extends AllowNames` | A generic `Name` variable constrained by the `AllowNames` indicates the name under which callback [`function`][js-function] is stored. By default, its value is captured from the provided `name` |\n\n**Parameters:**\n\n| Name: type                     | Description |\n| :----------------------------- | :---------- |\n| `name: Name`                   | A `string` type name that is restricted by the `AllowNames` under which the [`function`][js-function] is stored. The allowed status of the provided `name` is checked by the private method `isNameAllowed()` |\n| `resultHandler: ResultHandler` | The [`function`][js-function] of [`ResultHandler`](#resulthandler) to handle the result of the [`ResultCallback`][package-type-resultcallback] [`function`][js-function] before its result returns |\n\n**Returns:**\n\n| Returns | Type     | Description |\n| :------ | :------: | :---------- |\n| `this`  | `object` | The **return type** is an instance of `Callback` |\n\nThe **return value** is an instance of [`Callback`](#callback).\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Callback } from '@angular-package/core';\n/**\n * Initialize `Callback`.\n */\nconst callback = new Callback('firstName');\n\ncallback\n  .setCallback('firstName', result =\u003e result) // Set the callback function under the given name.\n```\n\n\u003cbr\u003e\n\n### `Callback.prototype.setErrorCallback`\n\nSets a [`function`][js-function] of a [`ResultCallback`][package-type-resultcallback] type to the storage under the given allowed name with the given error message to throw on the specified state from the `throwOnState`.\n\n```typescript\npublic setErrorCallback\u003cName extends AllowNames\u003e(\n  name: Name,\n  message: string | ErrorMessage,\n  throwOnState: boolean = false\n): this {\n  this.setCallback(name, Callback.defineErrorCallback(message, throwOnState));\n  return this;\n}\n```\n\n**Generic type variables:**\n\n| Name                      | Description |\n| :------------------------ | :---------- |\n| `Name extends AllowNames` | A generic `Name` variable constrained by the `AllowNames` indicates the name under which callback [`function`][js-function] is stored. By default, its value is captured from the provided `name` |\n\n**Parameters:**\n\n| Name: type                        | Description |\n| :-------------------------------- | :---------- |\n| `name: Name`                      | A `string` type name that is restricted by the `AllowNames` under which the [`function`][js-function] is stored. The allowed status of the provided `name` is checked by the private method `isNameAllowed()` |\n| `message: string \\| ErrorMessage` | The message of string type or [`ErrorMessage`](#errormessage) interface, to throw with an error of [`ValidationError`](#validationerror) |\n| `throwOnState: boolean`           | A state of [`boolean`][js-boolean] type on which an error of [`ValidationError`](#validationerror) should be thrown. By default, it's set to `false` |\n\n**Returns:**\n\n| Returns | Type     | Description |\n| :------ | :------: | :---------- |\n| `this`  | `object` | The **return type** is an instance of `Callback` |\n\nThe **return value** is an instance of [`Callback`](#callback).\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Callback } from '@angular-package/core';\n/**\n * Initialize `Callback`.\n */\nconst callback = new Callback('firstName', 'lastName');\n\ncallback\n  .setErrorCallback('lastName', 'LastName must be a string type', false); // Set the error callback function under the given name.\n```\n\n\u003cbr\u003e\n\n## Component loader\n\n### `ComponentLoader`\n\nAbstract class to handle Angular API for loading components dynamically.\n\n\u003cbr\u003e\n\n**Static methods:**\n\n|  Method                                          | Description |\n| :----------------------------------------------- | :---------- |\n| [`ComponentLoader.isContainer()`][cl-sm-1]       | Checks if the provided `value` is a [`ViewContainerRef`][angular-view-container-ref] type |\n| [`ComponentLoader.isFactoryResolver()`][cl-sm-2] | Checks if any `value` is a [`ComponentFactoryResolver`][angular-component-factory-resolver] by checking properties in prototype against the `resolveComponentFactory` |\n\n[cl-sm-1]: #componentloaderisfactoryresolver\n[cl-sm-2]: #componentloaderisfactoryresolver\n\n**Constructor:**\n\n| Constructor                                         | Description |\n| :-------------------------------------------------- | :---------- |\n| [`ComponentLoader()`](#componentloader-constructor) | Creates an instance with initializing [`ComponentFactoryResolver`][angular-component-factory-resolver] |\n\n**Instance methods:**\n\n| ComponentLoader.prototype.                      | Description |\n| :---------------------------------------------- | :---------- |\n| [`assignProperties()`][cl-im-assign-properties] | Assigns the whole object or its properties indicated by the provided `keys` to the dynamic component |\n| [`createComponent()`][cl-im-create-component]   | Creates component from the provided component or the stored factory, and loads its host view into the existing container |\n| [`destroyComponent()`][cl-im-destroy-component] | Destroys the existing component, all of the data structures associated with it, and clears the container. The status of destroying component result is stored in the `created` property, and it's `false` when component was successfully destroyed |\n| [`getProperty()`][cl-im-get-property]           | Gets the value of the property indicated by the provided `key` from the dynamic component |\n| [`isCreated()`][cl-im-is-created]               | Checks if the dynamic component is created by using the method [`createComponent()`][cl-im-create-component]. The result of the check is stored in the `created` property |\n| [`setContainer()`][cl-im-set-container]         | Sets the provided `container` of a [`ViewContainerRef`][angular-view-container-ref] when its property `_hostLView` is found |\n| [`setFactory()`][cl-im-set-factory]             | Sets the factory object based on the provided `component` of a `class` type |\n| [`setProperty()`][cl-im-set-property]           | Sets the value of a property indicated by the provided `key` of an instance of a `DynamicComponent` |\n\n[cl-im-assign-properties]: #componentloaderprototypeassignproperties\n[cl-im-create-component]: #componentloaderprototypedestroycomponent\n[cl-im-destroy-component]: #componentloaderprototypeiscontainer\n[cl-im-get-property]: #componentloaderprototypegetproperty\n[cl-im-is-created]: #componentloaderprototypeiscreated\n[cl-im-set-container]: #componentloaderprototypesetcontainer\n[cl-im-set-factory]: #componentloaderprototypesetfactory\n[cl-im-set-property]: #componentloaderprototypesetproperty\n\n\u003cbr\u003e\n\n### `ComponentLoader` instance properties\n\n----\n\n### `ComponentLoader.prototype.component`\n\nReturns privately stores component created by a `createComponent()` method.\n\n```typescript\npublic get component(): ComponentRef\u003cDynamicComponent\u003e | undefined {\n  return this.#component;\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.created`\n\nReturns the creation state of a dynamic component.\n\n```typescript\npublic get created(): boolean {\n  return this.$created;\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.instance`\n\nReturns an instance of the created dynamic component.\n\n```typescript\npublic get instance(): DynamicComponent | undefined {\n  return this.#component?.instance;\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader` static methods\n\n----\n\n### `ComponentLoader.isContainer()`\n\nChecks if the provided `value` is a [`ViewContainerRef`][angular-view-container-ref] type.\n\n```typescript\nstatic isContainer(\n  value: any,\n  callback?: ResultCallback\n): value is ViewContainerRef {\n  return is.objectKey(value, '_hostLView', callback);\n}\n```\n\n**Parameters:**\n\n| Name: type                  | Description |\n| :-------------------------- | :---------- |\n| `value: any`                | The `value` of any type to check |\n| `callback?: ResultCallback` | An optional [`ResultCallback`][package-type-resultcallback] function to handle the result of the check |\n\n**Returns:**\n\n| Returns                     | Type      | Description |\n| :-------------------------- | :-------: | :---------- |\n| `value is ViewContainerRef` | `boolean` | The **return type** is `boolean`, as the result of its statement that indicates the provided `value` is  [`ViewContainerRef`][angular-view-container-ref] |\n\nThe **return value** is a `boolean` indicating whether the `value` is a container of [`ViewContainerRef`][angular-view-container-ref].\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  ngAfterViewInit(): void {\n    ComponentLoader.isContainer(this.container);\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.isFactoryResolver()`\n\nChecks if any `value` is a `ComponentFactoryResolver` by checking properties in prototype against the `resolveComponentFactory`.\n\n```typescript\nstatic isFactoryResolver(\n  value: any,\n  callback?: ResultCallback\n): value is ComponentFactoryResolver {\n  return is.objectKeyIn(value, 'resolveComponentFactory', callback);\n}\n```\n\n**Parameters:**\n\n| Name: type                  | Description |\n| :-------------------------- | :---------- |\n| `value: any`                | The `value` of any type to check |\n| `callback?: ResultCallback` | An optional [`ResultCallback`][package-type-resultcallback] function to handle the result of the check |\n\n**Returns:**\n\n| Returns                             | Type      | Description |\n| :---------------------------------- | :-------: | :---------- |\n| `value is ComponentFactoryResolver` | `boolean` | The **return type** is `boolean`, as the result of its statement that indicates the provided `value` is  a [`ComponentFactoryResolver`][angular-component-factory-resolver] |\n\nThe **return value** is a `boolean` indicating whether the `value` is [`ComponentFactoryResolver`][angular-component-factory-resolver].\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: ''\n})\nexport class ExampleComponent {\n  constructor(\n    factoryResolver: ComponentFactoryResolver\n  ) {\n    ComponentLoader.isFactoryResolver(factoryResolver);\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader` constructor\n\n----\n\nCreates an instance with initializing [`ComponentFactoryResolver`][angular-component-factory-resolver].\n\n```typescript\nconstructor(\n  protected factoryResolver: ComponentFactoryResolver,\n  callback?: (callback: Callback\u003c\n    | 'getProperty'\n    | 'isContainer'\n    | 'isCreated'\n    | 'isFactoryResolver'\n    | 'setContainer'\n    | 'setFactory'\n    | 'setProperty'\n  \u003e) =\u003e void\n) {\n  // Checks the existence of a `ComponentFactoryResolver`. Needed when extends component.\n  ComponentLoader.isFactoryResolver(\n    factoryResolver,\n    this.#callback.getCallback('isFactoryResolver')\n  );\n  if (is.function(callback)) {\n    callback(this.#callback);\n  }\n}\n```\n\n**Parameters:**\n\n| Name: type                                  | Description |\n| :------------------------------------------ | :---------- |\n| `factoryResolver: ComponentFactoryResolver` | The required value of a [`ComponentFactoryResolver`][angular-component-factory-resolver] as a base for retrieving component factories |\n| `callback?: Callback\u003c\\| 'getProperty' \\| 'isContainer' \\| 'isCreated' \\| 'isFactoryResolver' \\| 'setContainer' \\| 'setFactory' \\| 'setProperty' \u003e` | |\n\n**Throws:**\n\nThrows an `Error` when [`ComponentFactoryResolver`][angular-component-factory-resolver] is not defined.\n\n**Returns:**\n\nThe **return value** is an instance of a child class.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: ''\n})\nexport class ExampleComponent extends ComponentLoader {\n  constructor(\n    factoryResolver: ComponentFactoryResolver\n  ) {\n    super(factoryResolver);\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader` instance methods\n\n----\n\n### `ComponentLoader.prototype.assignProperties()`\n\nAssigns the whole object or its properties indicated by the provided `keys` to the dynamic component\n\n```typescript\npublic assignProperties\u003c\n  Obj extends object,\n  Key extends keyof DynamicComponent\n\u003e(object: Obj, ...keys: Key[]): this {\n  if (guard.object(object) \u0026\u0026 guard.array(keys) \u0026\u0026 keys.length \u003e 0) {\n    keys.forEach((key) =\u003e {\n      Object.assign(this.instance, {\n        [key]: object[key as string as keyof Obj],\n      });\n    });\n  } else {\n    Object.assign(this.instance, object);\n  }\n  return this;\n}\n```\n\n**Generic type variables:**\n\n| Name                                 | Description |\n| :----------------------------------- | :---------- |\n| `Obj extends object`                 | A generic `Obj` variable that is guarded by the [`object`][js-object] type and is used by the provided `obj` from which it captures the default value |\n| `Key extends keyof DynamicComponent` | A generic `Key` variable that is constrained by the key of the provided `DynamicComponent` and is used by the `keys` rest parameter to indicate which properties values assign from the provided `Obj` |\n\n**Parameters:**\n\n| Name: type       | Description |\n| :--------------- | :---------- |\n| `object: Obj`    | An [`object`][js-object] to assign its properties to the dynamic component |\n| `...keys: Key[]` | A [rest parameter][js-function-rest-parameter] of property names from the dynamic component to assign from the provided `obj` |\n\n**Returns:**\n\nThe **return value** is an instance of a child class.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: `Dynamic component created successfully`\n})\nexport class DynamicComponent {\n  firstName = '';\n}\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent extends ComponentLoader\u003cDynamicComponent\u003e implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  constructor(public factoryResolver: ComponentFactoryResolver) {\n    super(factoryResolver);\n  }\n\n  ngAfterViewInit(): void {\n    this\n      .createComponent(DynamicComponent, this.container)\n      .assignProperties({\n        firstName: 'My first name'\n      }, 'firstName');\n    console.log(this.instance?.firstName); // Returns 'My first name'\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.createComponent()`\n\nCreates component from the provided `component` or the stored factory, and loads its host view into the existing `container`.\n\n```typescript\npublic createComponent(\n  component?: Type\u003cDynamicComponent\u003e,\n  container: ViewContainerRef = this.#container,\n  callback: ResultCallback = this.#callback.getCallback('createComponent')\n): this {\n  if (\n    ComponentLoader.isContainer(\n      container,\n      this.#callback.getCallback('isContainer')\n    )\n  ) {\n    if (is.false(this.isCreated())) {\n      if (is.class(component)) {\n        // Creates component by using the provided `component`.\n        this.#component = container.createComponent(\n          this.factoryResolver.resolveComponentFactory(component)\n        );\n      } else if (is.object(this.#factory)) {\n        // Creates component from the stored factory by the method `setFactory()`.\n        this.#component = container.createComponent(this.#factory);\n      }\n      // Stores the result of the component creation.\n      this.$created = this.isCreated(callback);\n    }\n  }\n  return this;\n}\n```\n\n**Parameters:**\n\n| Name: type                           | Description |\n| :----------------------------------- | :---------- |\n| `component?: Type\u003cDynamicComponent\u003e` | An optional [`class`][js-classes] of a `DynamicComponent` type |\n| `container: ViewContainerRef`        | A container of [`ViewContainerRef`][angular-view-container-ref] type to load component host view to it |\n| `callback?: ResultCallback`          | An optional [`ResultCallback`][package-type-resultcallback] function to handle the result of the check is component created |\n\n**Returns:**\n\nThe **return value** is an instance of a child class.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: `Dynamic component created successfully`\n})\nexport class DynamicComponent {}\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent extends ComponentLoader\u003cDynamicComponent\u003e implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  constructor(public factoryResolver: ComponentFactoryResolver) {\n    super(factoryResolver);\n  }\n\n  ngAfterViewInit(): void {\n    this.createComponent(DynamicComponent, this.container);\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.destroyComponent()`\n\nDestroys the existing component, all of the data structures associated with it, and clears the container. The status of destroying component result is stored in the `created` property, and it's `false` when component was successfully destroyed.\n\n```typescript\npublic destroyComponent(\n  callback?: ResultCallback\n): ComponentRef\u003cDynamicComponent\u003e | undefined {\n  if (this.isCreated()) {\n    // \"Destroys the component instance and all of the data structures associated with it.\"\n    this.#component?.destroy();\n    this.#component = undefined;\n  }\n  if (is.object(this.#container)) {\n    // \"Destroys all views in this container.\"\n    this.#container.clear();\n  }\n  // Stores the result of destroying the component. Should be `false`.\n  this.$created = is.undefined(this.#component, callback);\n  // The return value should be `undefined`.\n  return this.#component;\n}\n```\n\n**Parameters:**\n\n| Name: type                  | Description |\n| :-------------------------- | :---------- |\n| `callback?: ResultCallback` | An optional [`ResultCallback`][package-type-resultcallback] function to handle the result of the check whether a dynamic component is successfully destroyed |\n\n**Returns:**\n\nThe **return value** is `undefined` if the method successfully destroyed a privately stored component, or it's a component created by a `ComponentFactory`.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: `Dynamic component created successfully`\n})\nexport class DynamicComponent {}\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent extends ComponentLoader\u003cDynamicComponent\u003e implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  constructor(public factoryResolver: ComponentFactoryResolver) {\n    super(factoryResolver);\n  }\n\n  ngAfterViewInit(): void {\n    // Creates dynamic component.\n    this.createComponent(DynamicComponent, this.container);\n\n    setTimeout(() =\u003e {\n      // Destroys dynamic component.\n      this.destroyComponent();\n    }, 3000);\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.getProperty()`\n\nGets the value of the property indicated by the provided `key` from the dynamic component.\n\n```typescript\npublic getProperty\u003cKey extends keyof DynamicComponent\u003e(\n  key: Key,\n  callback: ResultCallback = this.#callback.getCallback('getProperty')\n): DynamicComponent[Key] | undefined {\n  if (is.objectKeyIn(this.instance, key, callback)) {\n    return this.instance[key];\n  }\n  return;\n}\n\n```\n\n**Generic type variables:**\n\n| Name                                 | Description |\n| :----------------------------------- | :---------- |\n| `Key extends keyof DynamicComponent` | A generic `Key` variable that is constrained by the key of the provided `DynamicComponent` and is used by the `key` parameter to indicate which property value get from the dynamic component instance |\n\n**Parameters:**\n\n| Name: type                 | Description |\n| :------------------------- | :---------- |\n| `key: Key`                 | The `key` of an instance of a `DynamicComponent` to get the property value. The value is being checked against the proper `key` and its existence in the instance of a dynamic component |\n| `callback: ResultCallback` | The function of a [`ResultCallback`][package-type-resultcallback] type to handle the result of the check whether the dynamic component exists, with its property from the provided `key`. By default, it uses an internal callback |\n\n**Throws:**\n\nThe method throws an [`error`][js-error] if the dynamic component is not created or it is created, but it has not a property of the specified `key`.\n\n**Returns:**\n\nThe **return value** is the value of the indicated property from the instance of a dynamic component.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: `Dynamic component created successfully`\n})\nexport class DynamicComponent {\n  firstName = 'My first name';\n}\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent extends ComponentLoader\u003cDynamicComponent\u003e implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  constructor(public factoryResolver: ComponentFactoryResolver) {\n    super(factoryResolver);\n  }\n\n  ngAfterViewInit(): void {\n    this\n      .createComponent(DynamicComponent, this.container);\n\n    console.log(this.getProperty('firstName')); // Returns 'My first name'\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.isCreated()`\n\nChecks if the dynamic component is created by using the method [`createComponent()`][cl-im-create-component]. The result of the check is stored in the [`created`](#componentloaderprototypecreated) property.\n\n```typescript\npublic isCreated(callback?: ResultCallback): boolean {\n  return is.object(this.#component, callback);\n}\n```\n\n**Parameters:**\n\n| Name: type                  | Description |\n| :-------------------------- | :---------- |\n| `callback?: ResultCallback` | An optional function of a [`ResultCallback`][package-type-resultcallback] type to handle the result of the check whether a dynamic component is already created |\n\n**Returns:**\n\nThe **return value** is a `boolean` indicating whether the dynamic component is already created.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: `Dynamic component created successfully`\n})\nexport class DynamicComponent {}\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent extends ComponentLoader\u003cDynamicComponent\u003e implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  constructor(public factoryResolver: ComponentFactoryResolver) {\n    super(factoryResolver);\n  }\n\n  ngAfterViewInit(): void {\n    this.createComponent(this.container, DynamicComponent);\n    console.log(this.isCreated()); // Returns `true`.\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.setContainer()`\n\nSets the provided `container` of a [`ViewContainerRef`][angular-view-container-ref] when its property `_hostLView` is found.\n\n```typescript\npublic setContainer(\n  container: ViewContainerRef,\n  callback: ResultCallback = this.#callback.getCallback('setContainer')\n): this {\n  if (ComponentLoader.isContainer(container, callback)) {\n    this.#container = container;\n  }\n  return this;\n}\n```\n\n**Parameters:**\n\n| Name: type                    | Description |\n| :---------------------------- | :---------- |\n| `container: ViewContainerRef` | The value of a [`class`][js-classes] type to retrieve the factory object |\n| `callback: ResultCallback`    | An optional function of a [`ResultCallback`][package-type-resultcallback] type to handle the result of the check whether a dynamic component is already created |\n\n**Returns:**\n\nThe **return value** is an instance of a child class.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: `Dynamic component created successfully`\n})\nexport class DynamicComponent {}\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent extends ComponentLoader\u003cDynamicComponent\u003e implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  constructor(public factoryResolver: ComponentFactoryResolver) {\n    super(factoryResolver);\n  }\n\n  ngAfterViewInit(): void {\n    this\n      .setContainer(this.container) // Sets the container.\n      .createComponent(DynamicComponent); // Creates the component.\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.setFactory()`\n\nSets the factory object based on the provided `component`.\n\n```typescript\npublic setFactory(\n  component: Type\u003cDynamicComponent\u003e,\n  callback: ResultCallback = this.#callback.getCallback('setFactory')\n): this {\n  if (guard.class(component, callback)) {\n    this.#factory = this.factoryResolver.resolveComponentFactory(component);\n  }\n  return this;\n}\n```\n\n**Parameters:**\n\n| Name: type                          | Description |\n| :---------------------------------- | :---------- |\n| `component: Type\u003cDynamicComponent\u003e` | [`Class`][js-classes] of a `DynamicComponent` type to retrieve the factory object |\n| `callback: ResultCallback`          | An optional function of a [`ResultCallback`][package-type-resultcallback] type to handle the result of the check whether a dynamic component is already created |\n\n**Returns:**\n\nThe **return value** is an instance of a child class.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: `Dynamic component created successfully`\n})\nexport class DynamicComponent {}\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent extends ComponentLoader\u003cDynamicComponent\u003e implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  constructor(public factoryResolver: ComponentFactoryResolver) {\n    super(factoryResolver);\n  }\n\n  ngAfterViewInit(): void {\n    this\n      .setContainer(this.container) // Sets the container.\n      .setFactory(DynamicComponent) // Sets the factory.\n      .createComponent(); // Creates the component.\n  }\n}\n```\n\n\u003cbr\u003e\n\n### `ComponentLoader.prototype.setProperty()`\n\nSets the value of a property indicated by the provided `key` of an instance of `DynamicComponent`.\n\n```typescript\npublic setProperty\u003cKey extends keyof DynamicComponent\u003e(\n  key: Key,\n  value: DynamicComponent[Key],\n  callback: ResultCallback = this.#callback.getCallback('setProperty')\n): this {\n  if (is.objectKeyIn(this.instance, key, callback)) {\n    this.instance[key] = value;\n  }\n  return this;\n}\n```\n\n**Generic type variables:**\n\n| Name                                 | Description |\n| :----------------------------------- | :---------- |\n| `Key extends keyof DynamicComponent` | A generic `Key` variable that is constrained by the key of the provided `DynamicComponent` and is used by the `key` parameter to indicate which property value get from the dynamic component instance |\n\n**Parameters:**\n\n| Name: type                     | Description |\n| :----------------------------- | :---------- |\n| `key: Key`                     | The `key` of a property from the instance of a `DynamicComponent` to set its value |\n| `value: DynamicComponent[Key]` | The `value` of a captured type from the property of `DynamicComponent` instance to set |\n| `callback: ResultCallback`     | The function of a [`ResultCallback`][package-type-resultcallback] type to handle the result of the check whether the dynamic component exists, with its property from the provided key. By default, it uses an internal callback |\n\n**Throws:**\n\nThe method throws an [`error`][js-error] if the dynamic component is not created or it is created, but it has not a property of the specified `key`.\n\n**Returns:**\n\nThe **return value** is an instance of a child class.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { Component, ViewChild, ViewContainerRef, AfterViewInit, ComponentFactoryResolver } from '@angular/core';\nimport { ComponentLoader } from '@angular-package/core';\n\n@Component({\n  template: `Dynamic component created successfully`\n})\nexport class DynamicComponent {\n  firstName = '';\n}\n\n@Component({\n  template: '\u003cdiv #newContainer\u003e\u003c/div\u003e',\n})\nexport class ExampleComponent extends ComponentLoader\u003cDynamicComponent\u003e implements AfterViewInit {\n  @ViewChild('newContainer', { read: ViewContainerRef }) container: any;\n\n  constructor(public factoryResolver: ComponentFactoryResolver) {\n    super(factoryResolver);\n  }\n\n  ngAfterViewInit(): void {\n    this\n      .createComponent(DynamicComponent, this.container)\n      .setProperty('firstName', 'My first name');\n    console.log(this.instance?.firstName); // Returns 'My first name'\n  }\n}\n```\n\n\u003cbr\u003e\n\n## Error\n\n```typescript\n/**\n * Error\n * -----\n * @angular-package/core/error\n */\nimport {\n  // Class.\n  ValidationError,\n  // Interface.\n  ErrorMessage,\n} from '@angular-package/core';\n```\n\n### `ValidationError`\n\nManages an [`Error`][js-error] of the validation.\n\n**Static methods:**\n\n| Methods                                                            | Description |\n| :----------------------------------------------------------------- | :---------- |\n| [`ValidationError.defineMessage()`](#validationerrordefinemessage) | Defines the error message of a [`string`][js-string] type from the provided `message` of an [`object`][js-object] |\n\n**Constructor:**\n\n| Constructor                                         | Description |\n| :-------------------------------------------------- | :---------- |\n| [`ValidationError()`](#validationerror-constructor) | Creates a new instance with the message. If the provided `message` is an [`object`][js-object], then its properties are assigned to the instance |\n\n\u003cbr\u003e\n\n### `ValidationError` static properties\n\n----\n\n### `ValidationError.template`\n\nTemplate of the error message with the replaceable `[problem]` and `[fix]`.\n\n```typescript\nstatic template = `Problem: [problem] =\u003e Fix: [fix]`;\n```\n\n\u003cbr\u003e\n\n### `ValidationError` instance public properties\n\n----\n\n### `ValidationError.prototype.fix`\n\nA possible solution to the described problem of a [`string`][js-string] type. By default, it's an empty [`string`][js-string].\n\n```typescript\npublic fix = '';\n```\n\n\u003cbr\u003e\n\n### `ValidationError.prototype.name`\n\nError name of a string type that is being thrown. By default, it's `ValidationError`.\n\n```typescript\npublic name = ValidationError.name;\n```\n\n\u003cbr\u003e\n\n### `ValidationError.prototype.problem`\n\nThe validation problem of a [`string`][js-string] type. By default, it's an empty string.\n\n```typescript\npublic problem = '';\n```\n\n\u003cbr\u003e\n\n### `ValidationError` static methods\n\n----\n\n### `ValidationError.defineMessage()`\n\nDefines the validation error message of a [`string`][js-string] type from the provided `message` of the [`ErrorMessage`](#errormessage) interface.\n\n```typescript\nstatic defineMessage(message: ErrorMessage): string {\n  if (is.objectKey(message, ['fix', 'problem'])) {\n    return `Problem: ${message.problem}. ${\n        is.string(message.fix) ? `Fix: ${message.fix}` : ''\n      }`;\n  }\n  return '';\n}\n```\n\n**Parameters:**\n\n| Name: type              | Description |\n| :---------------------- | :---------- |\n| `message: ErrorMessage` | An [`object`][js-object] of the [`ErrorMessage`](#errormessage) interface to build a message of a [`string`][js-string] type. The value is checked against the proper [`object`][js-object] |\n\n**Returns:**\n\nThe **return value** is a message of a `string` type created from the provided `message` of [`ErrorMessage`](#errormessage) interface, or it's an empty `string` if the provided message object isn't proper.\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { ValidationError } from '@angular-package/core';\n\nconst fix = 'There is no solution to the described problem.';\nconst problem = 'The problem has no solution.';\n/**\n * Returns\n * --------\n * Problem: The problem has no solution. =\u003e Fix: There is no solution to the described problem.\n */\nconst errorMessage = ValidationError.defineMessage({ fix, problem });\n```\n\n\u003cbr\u003e\n\n### `ValidationError` constructor\n\n----\n\n### `ValidationError()`\n\nCreates a new instance with the message. If the provided `message` is an [`object`][js-object], then its properties are assigned to the instance.\n\n```typescript\nnew ValidationError(message: string | ErrorMessage) {\n  super(is.string(message) ? message : ValidationError.defineMessage(message));\n  if (is.object(message)) {\n    Object.assign(this, getProperties(message, ['fix', 'problem']));\n  }\n}\n```\n\n**Parameters:**\n\n| Name: type                        | Description |\n| :-------------------------------- | :---------- |\n| `message: string \\| ErrorMessage` | The message of a `string` type or of an [`ErrorMessage`](#errormessage) interface that is used to throw with an [`error`][js-error] |\n\n**Returns:**\n\nThe **return value** is an instance of [`ValidationError`](#validationerror).\n\n**Usage:**\n\n```typescript\n// Example usage.\nimport { ValidationError } from '@angular-package/core';\n\nconst fix = 'There is no solution to the described problem.';\nconst problem = 'The problem has no solution.';\nconst validationError = new ValidationError({ fix, problem });\n```\n\n\u003cbr\u003e\n\n## Interface\n\n### ErrorMessage\n\nThe shape of an [`object`][js-object] for an [`error`][js-error] message that contains a possible solution to the described problem.\n\n```typescript\ninterface ErrorMessage {\n  /**\n   * Possible solution to the described problem of a `string` type.\n   */\n  fix: string;\n  /**\n   * Error problem of a `string` type.\n   */\n  problem: string;\n}\n```\n\n### ResultHandler\n\nFunction to handle the result of the [`ResultCallback`][package-type-resultcallback] [`function`][js-function] before its result returns.\n\n```typescript\ntype ResultHandler = (result: boolean, value: any) =\u003e void;\n```\n\n\u003cbr\u003e\n\n## GIT\n\n### Commit\n\n* [AngularJS Git Commit Message Conventions][git-commit-angular]\n* [Karma Git Commit Msg][git-commit-karma]\n* [Conventional Commits][git-commit-conventional]\n\n### Versioning\n\n[Semantic Versioning 2.0.0][git-semver]\n\n**Given a version number MAJOR.MINOR.PATCH, increment the:**\n\n* MAJOR version when you make incompatible API changes,\n* MINOR version when you add functionality in a backwards-compatible manner, and\n* PATCH version when you make backwards-compatible bug fixes.\n\nAdditional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.\n\n**FAQ**\nHow should I deal with revisions in the 0.y.z initial development phase?\n\n\u003e The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.\n\nHow do I know when to release 1.0.0?\n\n\u003e If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.\n\n## License\n\nMIT © angular-package ([license][core-license])\n\n\u003c!-- Funding --\u003e\n[github-badge-sponsor]: https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026link=https://github.com/sponsors/angular-package\n[github-sponsor-link]: https://github.com/sponsors/angular-package\n[patreon-badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dsciborrudnicki%26type%3Dpatrons\u0026style=flat\n[patreon-link]: https://patreon.com/sciborrudnicki\n\n[angulario]: https://angular.io\n[skeleton]: https://github.com/angular-package/skeleton\n\n\u003c!-- Update status --\u003e\n[fix]: https://img.shields.io/badge/-fix-red\n[new]: https://img.shields.io/badge/-new-green\n[update]: https://img.shields.io/badge/-update-red\n\n\u003c!-- GIT --\u003e\n[git-semver]: http://semver.org/\n\n\u003c!-- GIT: commit --\u003e\n[git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153\n[git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html\n[git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/\n\n\u003c!-- Package: core  --\u003e\n  \u003c!-- GitHub: badges --\u003e\n  [core-badge-issues]: https://img.shields.io/github/issues/angular-package/core\n  [core-badge-forks]: https://img.shields.io/github/forks/angular-package/core\n  [core-badge-stars]: https://img.shields.io/github/stars/angular-package/core\n  [core-badge-license]: https://img.shields.io/github/license/angular-package/core\n  \u003c!-- GitHub: badges links --\u003e\n  [core-issues]: https://github.com/angular-package/core/issues\n  [core-forks]: https://github.com/angular-package/core/network\n  [core-license]: https://github.com/angular-package/core/blob/master/LICENSE\n  [core-stars]: https://github.com/angular-package/core/stargazers\n\n\u003c!-- Package: core --\u003e\n  \u003c!-- npm --\u003e\n  [core-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Fcore.svg\n  [core-npm-badge]: https://badge.fury.io/js/%40angular-package%2Fcore\n  [core-npm-readme]: https://www.npmjs.com/package/@angular-package/core#readme\n\n  \u003c!-- GitHub --\u003e\n  [core-github-readme]: https://github.com/angular-package/core#readme\n\n\u003c!-- Package: change-detection --\u003e\n  \u003c!-- npm --\u003e\n  [cd-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Fchange-detection.svg\n  [cd-npm-badge]: https://badge.fury.io/js/%40angular-package%2Fchange-detection\n  [cd-npm-readme]: https://www.npmjs.com/package/@angular-package/change-detection#readme\n\n  \u003c!-- GitHub --\u003e\n  [cd-github-readme]: https://github.com/angular-package/change-detection#readme\n\n\u003c!-- Package: prism --\u003e\n  \u003c!-- npm --\u003e\n  [prism-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Fprism.svg\n  [prism-npm-badge]: https://badge.fury.io/js/%40angular-package%2Fprism\n  [prism-npm-readme]: https://www.npmjs.com/package/@angular-package/prism#readme\n\n  \u003c!-- GitHub --\u003e\n  [prism-github-readme]: https://github.com/angular-package/prism#readme\n\n\u003c!-- Package: property --\u003e\n  \u003c!-- npm --\u003e\n  [property-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Fproperty.svg\n  [property-npm-badge]: https://badge.fury.io/js/%40angular-package%2Fproperty\n  [property-npm-readme]: https://www.npmjs.com/package/@angular-package/property#readme\n\n  \u003c!-- GitHub --\u003e\n  [property-github-readme]: https://github.com/angular-package/property#readme\n\n\u003c!-- Package: reactive --\u003e\n  \u003c!-- npm --\u003e\n  [reactive-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Freactive.svg\n  [reactive-npm-badge]: https://badge.fury.io/js/%40angular-package%2Freactive\n  [reactive-npm-readme]: https://www.npmjs.com/package/@angular-package/reactive#readme\n\n  \u003c!-- GitHub --\u003e\n  [reactive-github-readme]: https://github.com/angular-package/reactive#readme\n\n\u003c!-- Package: testing --\u003e\n  \u003c!-- npm --\u003e\n  [testing-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Ftesting.svg\n  [testing-npm-badge]: https://badge.fury.io/js/%40angular-package%2Ftesting\n  [testing-npm-readme]: https://www.npmjs.com/package/@angular-package/testing#readme\n\n  \u003c!-- GitHub --\u003e\n  [testing-github-readme]: https://github.com/angular-package/testing#readme\n\n\u003c!-- Package: type --\u003e\n  \u003c!-- npm --\u003e\n  [type-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Ftype.svg\n  [type-npm-badge]: https://badge.fury.io/js/%40angular-package%2Ftype\n  [type-npm-readme]: https://www.npmjs.com/package/@angular-package/type#readme\n\n  \u003c!-- GitHub --\u003e\n  [type-github-readme]: https://github.com/angular-package/type#readme\n\n  [package-type-resultcallback]: https://github.com/angular-package/type#resultcallback\n  [package-type-key]: https://github.com/angular-package/type#key\n\n\u003c!-- Package: ui --\u003e\n  \u003c!-- npm --\u003e\n  [ui-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Fui.svg\n  [ui-npm-badge]: https://badge.fury.io/js/%40angular-package%2Fui\n  [ui-npm-readme]: https://www.npmjs.com/package/@angular-package/ui#readme\n\n  \u003c!-- GitHub --\u003e\n  [ui-github-readme]: https://github.com/angular-package/ui#readme\n\n\u003c!-- Angular --\u003e\n[angular-component-factory-resolver]: https://angular.io/api/core/ComponentFactoryResolver\n[angular-view-container-ref]: https://angular.io/api/core/ViewContainerRef\n\n\u003c!-- Jasmine --\u003e\n[jasmine-describe]: https://jasmine.github.io/api/3.8/global.html#describe\n[jasmine-expect]: https://jasmine.github.io/api/3.8/global.html#expect\n[jasmine-it]: https://jasmine.github.io/api/3.8/global.html#it\n\n\u003c!-- Javascript  --\u003e\n[js-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array\n[js-array-every]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every\n[js-array-some]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some\n\n[js-bigint]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt\n[js-bigintconstructor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/BigInt\n\n[js-boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean\n[js-booleanconstructor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/Boolean\n\n[js-classes]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes\n\n[js-date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date\n\n[js-error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n\n[js-function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions\n[js-function-rest-parameter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters\n\n[js-getter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get\n[js-object-getownpropertydescriptor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor\n[js-object-getOwnpropertydescriptors]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors\n\n[js-setter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set\n\n[js-hasownproperty]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty\n\n[js-instanceof]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof\n[js-in-operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in\n\n[js-map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n\n[js-null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null\n[js-number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number\n[js-numberconstructor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/Number\n\n[js-object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\n[js-object-define-property]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty\n\n[js-primitive]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive\n[js-promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\n\n[js-rangeerror]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError\n[js-referenceerror]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError\n[js-regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\n\n[js-set]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set\n[js-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Storage\n[js-string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String\n[js-stringconstructor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/String\n\n[js-symbol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol\n[js-symbolconstructor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/Symbol\n[js-syntaxerror]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError\n\n[js-typeerror]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError\n\n[js-undefined]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined\n[js-urlerror]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError\n\n[js-weakset]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet\n\n\u003c!-- --\u003e\n[karma]: http://karma-runner.github.io/0.10/index.html\n\n\u003c!-- Typescript --\u003e\n[ts-classes]: https://www.typescriptlang.org/docs/handbook/2/classes.html\n[ts-function]: https://www.typescriptlang.org/docs/handbook/2/functions.html\n[ts-interface]: https://www.typescriptlang.org/docs/handbook/interfaces.html#our-first-interface\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular-package%2Fcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangular-package%2Fcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular-package%2Fcore/lists"}