# @wazapp/utils

> Basic utils

Latest version **0.11.2** (published 2020-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wazapp/utils
pnpm add @wazapp/utils
yarn add @wazapp/utils
bun add @wazapp/utils
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.11.2 |
| Published | 2020-08-15 |
| First published | 2020-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Maciej Kwaśniak |
| Maintainers | exelord |

## Links

- npm: https://www.npmjs.com/package/@wazapp/utils
- Repository: https://github.com/wazappjs/wazapp
- Homepage: https://github.com/wazappjs/wazapp#readme
- Issues: https://github.com/wazappjs/wazapp/issues
- npm.io page: https://npm.io/package/@wazapp/utils

## Dependencies (1)

- [nanoid](https://npm.io/package/nanoid.md) ^3.1.9

## Recent versions

- 0.11.2 (latest) — 2020-08-15
- 0.11.0 — 2020-06-20
- 0.9.0 — 2020-06-20
- 0.8.0 — 2020-06-20
- 0.7.0 — 2020-06-07
- 0.6.0 — 2020-06-07
- 0.5.0 — 2020-06-03
- 0.4.0 — 2020-05-31

## README

# @wazapp/utils

Utils are a bunch of functionalities that can make your life easier. They are used internally by Wazapp packages, but you are encourage to use them as well.

## API

### guidFor

Returns a unique id for the object. If the object does not yet have a guid, one will be assigned to it. You can call this on any object, string, number, whatever...

You can also use this method on DOM Element objects.

#### API

Properties:
- `value`: `any` - value for which the guid will be generated
- `suffix`: `string` - optional suffix

#### Example

```typescript
import Component from "@wazapp/component";
import { guidFor } from '@wazapp/utils'

export default class FormComponent extends Component {
  template({ name }) {
    return (
      <form>
        <label htmlFor={guidFor(this, 'title')}>Title</label>
        <input id={guidFor(this, 'title')} name="title" />
      </form>
    );
  }
}

// Renders:
// <form>
//   <label for="w:1-w2">Title</label>
//   <input id="w:1-w2" name="title" />
// </form>
```

### uuid

Exposes: https://github.com/ai/nanoid

#### Example

```typescript
import { uuid } from '@wazapp/utils'

const newItemId = uuid();
```

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