@brandup/ui-helpers
Version:
45 lines (30 loc) • 861 B
Markdown
# brandup-ui-helpers
[]()
## Installation
Install NPM package [@brandup/ui-helpers](https://www.npmjs.com/package/@brandup/ui-helpers).
```
npm i @brandup/ui-helpers@latest
```
## String helpers
### Format text
Format with model values:
```TypeScript
const text = "Hello, {name}";
const result = text.format({ name: "Dmitry" }); // Hello, Dmitry
```
Format with arguments:
```TypeScript
const text = "Hello, {0}";
const result = text.format("Dmitry"); // Hello, Dmitry
```
## Object helpers
### Get value by property path
```TypeScript
const model = {
header: {
value: "Item"
}
}
const value = Object.prop(model, "header.value"); // return "Item"
const hasValue = Object.hasProp(model, "header.value"); // return true
```