# @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();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://exelord.gitbook.io/wazapp/packages/utils.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
