# inherits

> Browser-friendly inheritance fully compatible with standard node.js inherits()

Latest version **2.0.4** (published 2019-06-19) · ISC license · 0 weekly downloads

> **Native alternative:** Use native class syntax — Use native JavaScript (Node 6.0.0+) (https://developer.mozilla.orgClasses/extends)

## Install

```sh
npm install inherits
pnpm add inherits
yarn add inherits
bun add inherits
```

## Health

**Score 33/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2019-06-19 |
| First published | 2011-04-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/inherits) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 353 |
| Maintainers | isaacs |
| Keywords | inheritance, class, klass, oop, object-oriented, inherits, browser, browserify |

## Links

- npm: https://www.npmjs.com/package/inherits
- Repository: https://github.com/isaacs/inherits
- Homepage: https://github.com/isaacs/inherits#readme
- Issues: https://github.com/isaacs/inherits/issues
- npm.io page: https://npm.io/package/inherits

## 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

- 2.0.4 (latest) — 2019-06-19
- 2.0.3 — 2016-09-08
- 1.0.2 — 2015-08-27
- 1.0.1 — 2015-08-26
- 2.0.1 — 2013-08-19
- 2.0.0 — 2013-05-16
- 1.0.0 — 2011-04-07

## README

Browser-friendly inheritance fully compatible with standard node.js
[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).

This package exports standard `inherits` from node.js `util` module in
node environment, but also provides alternative browser-friendly
implementation through [browser
field](https://gist.github.com/shtylman/4339901). Alternative
implementation is a literal copy of standard one located in standalone
module to avoid requiring of `util`. It also has a shim for old
browsers with no `Object.create` support.

While keeping you sure you are using standard `inherits`
implementation in node.js environment, it allows bundlers such as
[browserify](https://github.com/substack/node-browserify) to not
include full `util` package to your client code if all you need is
just `inherits` function. It worth, because browser shim for `util`
package is large and `inherits` is often the single function you need
from it.

It's recommended to use this package instead of
`require('util').inherits` for any code that has chances to be used
not only in node.js but in browser too.

## usage

```js
var inherits = require('inherits');
// then use exactly as the standard one
```

## note on version ~1.0

Version ~1.0 had completely different motivation and is not compatible
neither with 2.0 nor with standard node.js `inherits`.

If you are using version ~1.0 and planning to switch to ~2.0, be
careful:

* new version uses `super_` instead of `super` for referencing
  superclass
* new version overwrites current prototype while old one preserves any
  existing fields on it

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