gitwtfhub

wtf is inherits?

isaacs/inherits — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2025-10-25

353JavaScriptAudience · developerComplexity · 1/5QuietLicenseSetup · easy

TL;DR

A tiny JavaScript helper that sets up class inheritance, matching Node.js's built-in version but lightweight enough to use in browsers too.

Mindmap

mindmap
  root((repo))
    What it does
      Mirrors Node util inherits
      Browser friendly version
      Old browser fallback
    Tech stack
      JavaScript
      Node.js
    Use cases
      Share inheritance code
      Avoid heavy polyfills
      Isomorphic UI libraries
    Audience
      JS developers
      Library authors
    Caveats
      v1 to v2 breaking change
      super_ reference changed

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Share the same class-inheritance behavior between server-side Node.js code and browser-side JavaScript.

REASON 2

Avoid pulling in a large Node.js utility polyfill just to get one inheritance helper in the browser.

REASON 3

Build a UI component library or shared module that needs consistent inheritance in both environments.

REASON 4

Upgrade an old browser-targeted codebase's inheritance helper without adding extra bundle weight.

What's in the stack?

JavaScriptNode.js

How it stacks up

isaacs/inheritsparaschopra/make-pages-interactiveebookfoundation/free-programming-books-search
Stars353339368
LanguageJavaScriptJavaScriptJavaScript
Last pushed2025-10-25
MaintenanceQuiet
Setup difficultyeasyeasymoderate
Complexity1/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Version 1.0 and 2.0 are incompatible, upgrading old code requires changing how the parent class is referenced.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

Wtf does this do

This package gives JavaScript developers a simple way to set up inheritance, the mechanism where one object type borrows behavior from another. It mirrors a helper function that comes built into Node.js (a popular JavaScript runtime), but it's designed to work smoothly in web browsers too. In JavaScript, you often want one "class" of object to extend another, so a Dog can reuse everything an Animal already does. Node.js provides a function for this, but pulling that function into browser-based code normally drags along a large, heavy utility package. This project solves that by giving you the exact same function with a lightweight browser-friendly version that skips the baggage. It even includes a fallback for very old browsers. You'd use this if you're writing JavaScript that needs to run both on a server (Node.js) and in a browser, and you want inheritance to work consistently in both places without bloating your download size. For example, if you're building a UI component library that shares code between a backend and frontend, this keeps things tidy. The README recommends using it instead of the built-in Node.js version whenever your code might end up running in a browser. One thing to note: version 1.0 of this package behaved differently and isn't compatible with the current version 2.0. If you're upgrading from the old version, be aware that the way you reference a parent class changed (it now uses super_), and the new version overwrites existing prototype fields rather than preserving them. For most people starting fresh, this won't matter, but it's worth knowing if you're maintaining older code.

Yoink these prompts

Prompt 1
Show me how to use the inherits package to make a Dog class extend an Animal class in JavaScript.
Prompt 2
How do I add inherits to a project so the same inheritance code works in both Node.js and the browser?
Prompt 3
Explain what changed between inherits v1 and v2, and how I'd migrate old code using super_ to the new version.
Prompt 4
Why would I use the inherits package instead of Node's built-in util.inherits in browser-targeted code?

Frequently asked questions

wtf is inherits?

A tiny JavaScript helper that sets up class inheritance, matching Node.js's built-in version but lightweight enough to use in browsers too.

What language is inherits written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js.

Is inherits actively maintained?

Quiet — no commits in 6-12 months (last push 2025-10-25).

What license does inherits use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is inherits to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is inherits for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.