> For the complete documentation index, see [llms.txt](https://docs.datajet-app.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datajet-app.com/liquid/filters/is_number.md).

# is\_number

Tests whether a value can be cast to a number, without casting it. The guard that pairs with `integer` and `decimal`.

```liquid
{% if row.qty | is_number %}...{% endif %}
```

## Syntax

```liquid
{{ value | is_number }}
```

| Parameter | Description       |
| --------- | ----------------- |
| `value`   | Any value to test |

## Return Value

Returns `true` when `integer`/`decimal` would succeed on the value, `false` otherwise.

## Examples

**Report bad rows instead of importing them silently:**

```liquid
{% for row in rows %}
  {% unless row.price | is_number %}
    {% assign invalid = invalid | push: row.sku %}
    {% continue %}
  {% endunless %}
  {% assign price = row.price | decimal %}
{% endfor %}
{% if invalid.size > 0 %}
  {% log "Rows skipped, price is not numeric: " | append: invalid | join: ", " %}
{% endif %}
```

**Branch on the shape of an incoming value:**

```liquid
{% if payload.customer_id | is_number %}
  {% assign id = payload.customer_id | integer %}
{% else %}
  {% assign id = payload.customer_id | split: "/" | last | integer %}
{% endif %}
```

## Notes

* Uses exactly the same rule as `integer` and `decimal`, so a `true` result guarantees the cast returns a number rather than the fallback
* `"0x1F"`, `"1e3"`, `"1,234"`, `""`, `true` and missing variables are all `false`
* To inspect the underlying JavaScript type instead, use `type`
* See also: `integer`, `decimal`, `type`
