# Types

## Boolean

Use the `wire.toBoolean` function to determine if a value of any type is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).  Use the second parameter to return a default if the value passed in is not able to be evaluated.

The following example sets the `bool` variable to `true`because the string `"true"` will evaluate to `true`.

```javascript
const bool = wire.toBoolean("true", false);
```

The following example also sets the `bool` variable to `true` because the value `null` passed in cannot be evaluated as a proper Boolean.  The function defaults to the second parameter `true`.  If the second parameter was not passed in, the function would return `false`.

```javascript
const bool = wire.toBoolean(null, true);
```

## Numeric

To determine whether a value of any type is a number, use the `wire.inNumeric` function. &#x20;

```javascript
const number = wire.isNumeric("1234");
```

## Guid

To create a universal unique identifier, use the `wire.guid` function.

```javascript
const id = wire.guid();

// id = f09a1e51-7dbf-49c2-b252-ff16c3b42a7a
```

### Short Guid

To create a 6 character random alphanumeric value, use the `guidShort` function.

```javascript
const id = wire.guidShort();

// id = nzcp6z
```


---

# 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://docs.wirebootstrap.com/wirebootstrap/utilities/types.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.
