# reflect.getprototypeof

> An ES2015 mostly-spec-compliant `Reflect.getPrototypeOf` sham/polyfill/replacement that works in as many engines as possible

Latest version **1.0.10** (published 2025-01-02) · MIT license · 0 weekly downloads

> **Native alternative:** Reflect.getPrototypeOf — Use native JavaScript (Node 6.0.0+) (https://developer.mozilla.orgGlobal_Objects/Reflect/getPrototypeOf)

## Install

```sh
npm install reflect.getprototypeof
pnpm add reflect.getprototypeof
yarn add reflect.getprototypeof
bun add reflect.getprototypeof
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2025-01-02 |
| First published | 2021-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 0.4 |
| Dependencies | 8 |
| Unpacked size | 22.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | Reflect.getPrototypeOf, Object.getPrototypeOf, proto, __proto__, [[Prototype]], getPrototypeOf, ES5, shim, polyfill, es-shim API, browser |

## Links

- npm: https://www.npmjs.com/package/reflect.getprototypeof
- Repository: https://github.com/es-shims/Reflect.getPrototypeOf
- Issues: https://github.com/es-shims/Reflect.getPrototypeOf/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/reflect.getprototypeof

## Dependencies (8)

- [call-bind](https://npm.io/package/call-bind.md) ^1.0.8
- [es-errors](https://npm.io/package/es-errors.md) ^1.3.0
- [get-proto](https://npm.io/package/get-proto.md) ^1.0.1
- [es-abstract](https://npm.io/package/es-abstract.md) ^1.23.9
- [get-intrinsic](https://npm.io/package/get-intrinsic.md) ^1.2.7
- [es-object-atoms](https://npm.io/package/es-object-atoms.md) ^1.0.0
- [define-properties](https://npm.io/package/define-properties.md) ^1.2.1
- [which-builtin-type](https://npm.io/package/which-builtin-type.md) ^1.2.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.10 (latest) — 2025-01-02
- 1.0.9 — 2024-12-18
- 1.0.8 — 2024-12-06
- 1.0.7 — 2024-11-23
- 1.0.6 — 2024-03-17
- 1.0.5 — 2024-02-05
- 1.0.4 — 2023-08-31
- 1.0.3 — 2022-11-07
- 1.0.2 — 2021-10-04
- 1.0.1 — 2021-09-08
- 1.0.0 — 2021-01-12

## README

# reflect.getprototypeof <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

An ES2015 mostly-spec-compliant `Reflect.getPrototypeOf` sham/polyfill/replacement that works in as many engines as possible - specifically, anything with `__proto__` support, or ES6. Built-in types will also work correctly in older engines.

This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/5.1/).

## Example

```js
var getPrototypeOf = require('reflect.getprototypeof');
var assert = require('assert');

assert.throws(() => getPrototypeOf(true));
assert.throws(() => getPrototypeOf(42));
assert.throws(() => getPrototypeOf(''));
assert.equal(getPrototypeOf(/a/g), RegExp.prototype);
assert.equal(getPrototypeOf(new Date()), Date.prototype);
assert.equal(getPrototypeOf(function () {}), Function.prototype);
assert.equal(getPrototypeOf([]), Array.prototype);
assert.equal(getPrototypeOf({}), Object.prototype);
```

```js
var getPrototypeOf = require('reflect.getprototypeof');
var assert = require('assert');
/* when Reflect or Reflect.getPrototypeOf is not present */
if (typeof Reflect === 'object') { delete Reflect.getPrototypeOf; }
delete globalThis.Reflect;
var shimmed = getPrototypeOf.shim();
assert.equal(shimmed, getPrototypeOf.getPolyfill());

assert.throws(() => Reflect.getPrototypeOf(true));
assert.throws(() => Reflect.getPrototypeOf(42));
assert.throws(() => Reflect.getPrototypeOf(''));
assert.equal(Reflect.getPrototypeOf(/a/g), RegExp.prototype);
assert.equal(Reflect.getPrototypeOf(new Date()), Date.prototype);
assert.equal(Reflect.getPrototypeOf(function () {}), Function.prototype);
assert.equal(Reflect.getPrototypeOf([]), Array.prototype);
assert.equal(Reflect.getPrototypeOf({}), Object.prototype);
```

```js
var getPrototypeOf = require('reflect.getprototypeof');
var assert = require('assert');
/* when Reflect.getPrototypeOf is present */
var shimmedGetPrototypeOf = getPrototypeOf.shim();
assert.equal(shimmedGetPrototypeOf, Reflect.getPrototypeOf);
assert.equal(Reflect.getPrototypeOf([]), Array.prototype);
```

## Tests
Simply clone the repo, `npm install`, and run `npm test`

[package-url]: https://npmjs.org/package/reflect.getprototypeof
[npm-version-svg]: https://versionbadg.es/es-shims/Reflect.getPrototypeOf.svg
[deps-svg]: https://david-dm.org/es-shims/Reflect.getPrototypeOf.svg
[deps-url]: https://david-dm.org/es-shims/Reflect.getPrototypeOf
[dev-deps-svg]: https://david-dm.org/es-shims/Reflect.getPrototypeOf/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Reflect.getPrototypeOf#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/reflect.getprototypeof.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/reflect.getprototypeof.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/reflect.getprototypeof.svg
[downloads-url]: https://npm-stat.com/charts.html?package=reflect.getprototypeof
[codecov-image]: https://codecov.io/gh/es-shims/Reflect.getPrototypeOf/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Reflect.getPrototypeOf/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Reflect.getPrototypeOf
[actions-url]: https://github.com/es-shims/Reflect.getPrototypeOf/actions

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