# exc-core

> ExcCoreModule implements some static core features for the app and the communication between components, directives, services etc.

Latest version **1.0.4** (published 2020-09-24) · 0 weekly downloads

## Install

```sh
npm install exc-core
pnpm add exc-core
yarn add exc-core
bun add exc-core
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-09-24 |
| First published | 2018-11-14 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 261.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | markus.heiss.excon.com, risatronex |

## Links

- npm: https://www.npmjs.com/package/exc-core
- npm.io page: https://npm.io/package/exc-core

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Recent versions

- 1.0.4 (latest) — 2020-09-24
- 1.0.3 — 2020-09-24
- 1.0.2 — 2020-09-18
- 1.0.1 — 2020-05-08
- 1.0.0 — 2020-02-19
- 0.4.0 — 2019-09-10
- 0.3.3 — 2019-07-09
- 0.3.2 — 2019-06-13
- 0.3.1 — 2019-05-24
- 0.3.0 — 2019-05-13
- 0.2.1 — 2019-04-03
- 0.2.0 — 2019-03-28
- 0.1.2 — 2019-02-25
- 0.1.0 — 2018-12-17
- 0.0.3 — 2018-11-16
- … 2 more at https://npm.io/package/exc-core/versions

## README

# Documentation


## Module Exc-Core
ExcCoreModule implements some static core features for the app and the communication between components, directives, services etc.

### Members
#### Array
##### Methods
|Method|Return|Description|
| --- | --- | --- |
| Get(array,value)|**any**|Gets the first entry from array matches to value|
| GetIndex(array,value)|**number**|Gets the index of the first entry from array matches to value|
| GetObject(array, key, value)|**any**|Gets the first entry from array of objects where the object[key] matches to value|
| GetObjectIndex(array, key, value)|**number**|Gets the index of the first entry from array of objects where the object[key] matches to value|
| GetAll(array, key, value)|**any[]**|Gets all entries from array of objects where the object[key] matches to value|
| Remove(array, value)|**any[]**|Removes the first element from the array matches to the value. Returns remaining array items|
| RemoveObject(array, key, value)|**any[]**|Removes the first element from the array matches to the value. Returns remaining array items|
| RemoveAll(array, value)|**any[]**|Removes all elements from the array matches to the value. Returns remaining array items|
| RemoveObjectAll(array, key, value)|**any[]**|Removes all elements from the array matches to the value. Returns remaining array items|
| Add(array, value)|**any[]**|Adds an element to the array. Returns result array|
| Merge(array1, array2)|**any[]**|Adds all elementes of array2 to array1. Returns merged array|
| Exists(array, value)|**boolean**|Search an array for an element matches to the value.  Returns true or false|
| ExistsObject(array, key, value)|**boolean**|Search an array for an element where the object[key] matches to the value. Returns true or false|
| Distinct(array)|**any[]**|Removes duplicated items in array.|
| ExistsObject(array, key)|**any[]**|Removes duplicated items in array where the object[key] matches.|



#### Guid
##### Methods
|Method|Return|Description|
| --- | --- | --- |
|NewGuid()|**string**|Generates a new uniqueidentifier (Guid)|

#### Object
##### Methods
|Method|Return|Description|
| --- | --- | --- |
|Replace(destination,source)|**void**|Replaces all values in destination object from source object.<br />*Keeps values in destination if they doesn't exist in source<br />Ignores values from source if they doesn't exist in destination*|
|Merge(destination,...source)|**void**|*Merges values from all source objects to destination object*|
|DeepMerge(destination,...source)|**void**|*Merges (recursive) values from all source objects to destination object*|

#### String
##### Methods
|Method|Return|Description|
| --- | --- | --- |
|Format(text,...args)|**string**|Formats a string and injects the arguments by index<br />***Example***<br/>`ExcCoreModule.String.Format("This {0} is crazy for {1}!","world","Robin")` returns *"This world is crazy for Robin!"*|
|Reverse(text)|**string**|Reverses a given string|

### Methods
|Method|Return|Description|
| --- | --- | --- |
|on(name,callback)|**function**|Registers a callback function to a specified name as an event|
|call(name,...args)|**function**|Calls all callback functions for the specified name and tunnels all arguments to callback functions.|
|showInfo(message,title?)|**void**|Calls "***eAM.ShowInfo***" event. Listening to this event with <br /> `ExcCoreModule.on("eAM.ShowInfo",function(message,title){//Your code here});`|
|showSuccess(message,title?)|**void**|Calls "***eAM.ShowSuccess***" event. Listening to this event with <br /> `ExcCoreModule.on("eAM.ShowSuccess",function(message,title){//Your code here});`|
|showWarning(message,title?)|**void**|Calls "***eAM.ShowWarning***" event. Listening to this event with <br /> `ExcCoreModule.on("eAM.ShowWarning",function(message,title){//Your code here});`|
|showError(message,title?)|**void**|Calls "***eAM.ShowError***" event. Listening to this event with <br /> `ExcCoreModule.on("eAM.ShowError []() ",function(message,title){//Your code here});`|
|showModal(content,header?,size?,data?,closeViaOverlay?,footerButtons?)|**Observable**|Open a modal window as configured. Place content as string or place a component name|
|RegisterService(key,value)|**void**|Registers a value to ExcCoreModule.Services().|
|RegisterConfig(key,value)|**void**|Registers a value to ExcCoreModule.Config().|
|Services()|**any**|Gets all values registered by RegisterService(key,value)|
|Config()|**any**|Gets all values registered by RegisterConfig(key,value)|


## Module Exc-Translation
Exc-Translation is a class for translation of text resources. All other classes using translation have to extend this class

Usage: export class ClassName extends ExcTranslation

After this you have the option to use translations in `ClassName`

### Methods
|Method|Return|Description|
| --- | --- | --- |
|getCurrentLang()|**string**|Get current selected language as string|
|onLangChange|**Observable<string>**|Define a callback function which is called at language change|
|getRessource(name,param?)|**string**|Get a text resource of the current ClassName and the selected language. You can use placeholders in translation file to pass params to specific positions|
|getGlobal(name,param?)|**string**|Get a global text resource and the selected language. You can use placeholders in translation file to pass params to specific positions|
|getTranslation(name,param?)|**string**|Get text resource from root position and the selected language. You can use placeholders in translation file to pass params to specific positions|

---
_Source: https://npm.io/package/exc-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
