# @se-oss/is

> Elegant and type-safe value validation library for TypeScript and JavaScript.

Latest version **1.0.0** (published 2026-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @se-oss/is
pnpm add @se-oss/is
yarn add @se-oss/is
bun add @se-oss/is
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2026-01-08 |
| First published | 2026-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 71.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Shahrad Elahi |
| Maintainers | shahradelahi |
| Keywords | is, type-check, validation, type-safe, checker, type, predicate |

## Links

- npm: https://www.npmjs.com/package/@se-oss/is
- Repository: https://github.com/shahradelahi/is
- Issues: https://github.com/shahradelahi/is/issues
- npm.io page: https://npm.io/package/@se-oss/is

## Dependencies (1)

- [@se-oss/typeof](https://npm.io/package/@se-oss/typeof.md) ^1.1.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2026-01-08

## README

# @se-oss/is

[![CI](https://github.com/shahradelahi/is/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/shahradelahi/is/actions/workflows/ci.yml)
[![NPM Version](https://img.shields.io/npm/v/@se-oss/is.svg)](https://www.npmjs.com/package/@se-oss/is)
[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](/LICENSE)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/@se-oss/is)
[![Install Size](https://packagephobia.com/badge?p=@se-oss/is)](https://packagephobia.com/result?p=@se-oss/is)

_@se-oss/is_ is an elegant and type-safe value validation library for TypeScript and JavaScript.

---

- [Installation](#-installation)
- [Usage](#-usage)
- [Documentation](#-documentation)
- [Contributing](#-contributing)
- [License](#license)

## 📦 Installation

```bash
npm install @se-oss/is
```

<details>
<summary>Install using your favorite package manager</summary>

**pnpm**

```bash
pnpm install @se-oss/is
```

**yarn**

```bash
yarn add @se-oss/is
```

</details>

## 📖 Usage

### Basic validation

```typescript
import is from '@se-oss/is';

is.string('☕');
//=> true

is.number(42);
//=> true

is.array([1, 2, 3]);
//=> true

is.urlInstance(new URL('https://example.com'));
//=> true
```

### Type detection

```typescript
import is from '@se-oss/is';

is('hello');
//=> 'string'

is(new Map());
//=> 'Map'

is(new Uint8Array());
//=> 'Uint8Array'
```

### Type narrowing

```typescript
import is from '@se-oss/is';

const value: unknown = '☕';

if (is.string(value)) {
  console.log(value.length);
  //=> 2
}
```

### Logical operators

```typescript
import is from '@se-oss/is';

// Check if any of the predicates match
is.any([is.string, is.number], 'hello');
//=> true

// Check if all of the predicates match
is.all([is.array, is.nonEmptyArray], [1, 2, 3]);
//=> true

// Check if a value is optional
is.optional(undefined, is.string);
//=> true

// Use as predicate factories
const isStringOrNumber = is.any([is.string, is.number]);
isStringOrNumber('hello');
//=> true
```

### Advanced usage

```typescript
import is from '@se-oss/is';

// Validate array elements
is.array([1, 2, 3], is.number);
//=> true

// Check if a number is in range
is.inRange(3, [0, 5]);
//=> true

// Check for plain objects
is.plainObject({ a: 1 });
//=> true
```

### Web & String validation

```typescript
import is from '@se-oss/is';

is.json('{"a":1}');
//=> true

is.base64('SGVsbG8gd29ybGQ=');
//=> true

is.ipv4('127.0.0.1');
//=> true

is.hexColor('#ffffff');
//=> true
```

## 📚 Documentation

For all configuration options, please see [the API docs](https://www.jsdocs.io/package/@se-oss/is).

## 🤝 Contributing

Want to contribute? Awesome! To show your support is to star the project, or to raise issues on [GitHub](https://github.com/shahradelahi/is)

Thanks again for your support, it is much appreciated! 🙏

## License

[MIT](/LICENSE) © [Shahrad Elahi](https://github.com/shahradelahi) and [contributors](https://github.com/shahradelahi/is/graphs/contributors).

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