# es-typeof

> Ponyfill of built-in `typeof` operator.

Latest version **1.0.0** (published 2025-12-20) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install es-typeof
pnpm add es-typeof
yarn add es-typeof
bun add es-typeof
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2025-12-20 |
| First published | 2025-12-20 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | me |
| Maintainers | tj-commits |
| Keywords | type, of |

## Links

- npm: https://www.npmjs.com/package/es-typeof
- Repository: https://github.com/is-unknown/typeof
- Homepage: https://github.com/is-unknown/typeof#readme
- Issues: https://github.com/is-unknown/typeof/issues
- npm.io page: https://npm.io/package/es-typeof

## Dependencies (7)

- [call-bound](https://npm.io/package/call-bound.md) ^1.0.4
- [has-bigints](https://npm.io/package/has-bigints.md) ^1.1.0
- [has-symbols](https://npm.io/package/has-symbols.md) ^1.1.0
- [es-object-atoms](https://npm.io/package/es-object-atoms.md) ^1.1.1
- [lodash.includes](https://npm.io/package/lodash.includes.md) ^4.3.0
- [@extremejs/utils](https://npm.io/package/@extremejs/utils.md) ^1.0.0-beta.22
- [extract-stringtag](https://npm.io/package/extract-stringtag.md) ^1.0.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2025-12-20

## README

# es-typeof

A robust ponyfill for the JavaScript `typeof` operator. It replicates the exact logic of the native `typeof` operator while ensuring stability across different environments and realms.

## Installation

```bash
npm install es-typeof
```

## Usage

```javascript
var typeOf = require("es-typeof")

typeOf(undefined)     // "undefined"
typeOf(null)          // "object"
typeOf(true)          // "boolean"
typeOf(42)            // "number"
typeOf("hello")       // "string"
typeOf(Symbol("foo")) // "symbol"
typeOf(BigInt(10))    // "bigint"
typeOf(function() {}) // "function"
typeOf({})            // "object"
typeOf([])            // "object"
```

## Why use this instead of native `typeof`?

While it behaves the same as the `typeof` keyword, this library is built using `get-intrinsic` and `call-bound`. This makes it resistant to environments where global prototypes or constructors have been modified. It also ensures that functions like `AsyncFunction` and `GeneratorFunction` are consistently identified even in older or exotic engines.

## Testing

The library includes a comprehensive test suite covering primitives, modern types (Symbols/BigInts), and various function types.

```bash
node test.js
```

## License

Unlicense

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