> For the complete documentation index, see [llms.txt](https://docs.medable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.medable.com/cortex-api/scripting/modules-1/util.ip-module.md).

# Util.ip Module

\
&#x20;Import

```
import { ip } from 'util';
```

### Methods

[is\_ipv4(ip)](https://docs.medable.com/reference#section-is_ipv4-ip-)\
[is\_cidr(cidr)](https://docs.medable.com/reference#section-is_cidr-cidr-)\
[contains\_ip(array, ip)](https://docs.medable.com/reference#section-contains_ip-array-ip-)\
[ip4toint(ip)](https://docs.medable.com/reference#section-ip4toint-ip-)\
[inttoip4(int)](https://docs.medable.com/reference#section-inttoip4-int-)\
[ip4incidr(ip, cidr)](https://docs.medable.com/reference#section-ip4incidr-ip-cidr-)

### is\_ipv4(ip)

Returns true if the argument is a valid IPv4 address.

**Arguments**

* `ip` (String)

**Returns**

Boolean

### is\_cidr(cidr)

Returns true if the argument is a valid IPv4 address range.

**Arguments**

* `cidr` (String)

**Returns**

Boolean

### contains\_ip(array, ip)

Returns true if the `ip` argument is a valid IPv4 address and contained `array`.

**Arguments**

* `array` (String\[]) An array of ip addresses or cidr ranges against which to match `ip`
* `ip` (String)

**Returns**

Boolean

### ip4toint(ip)

Converts an IPv4 string to an integer.

**Arguments**

* `ip` (String)

**Returns**

Number

### inttoip4(int)

Converts an integer to an IPv4 string.

**Arguments**

* `int` (Number)

**Returns**

String

### ip4incidr(ip, cidr)

Returns true if `ip` is contained in the `cidr` range.

**Arguments**

* `ip` (String)
* `cidr` (String)

**Returns**

Boolean


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.medable.com/cortex-api/scripting/modules-1/util.ip-module.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.
