Socket
Socket
Sign inDemoInstall

component-inherit

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    component-inherit

Prototype inheritance utility


Version published
Weekly downloads
1.2M
decreased by-12.86%
Maintainers
1
Install size
2.50 kB
Created
Weekly downloads
 

Package description

What is component-inherit?

The component-inherit npm package is a simple utility module for inheriting the prototype of one JavaScript constructor into another. It is primarily used to achieve classical inheritance patterns in JavaScript.

What are component-inherit's main functionalities?

Classical Inheritance

This feature allows one constructor (Child) to inherit the prototype methods and properties from another constructor (Parent), enabling instances of the Child to use the Parent's methods and properties.

function Parent() {}
Parent.prototype.parentMethod = function() {};

function Child() {}
require('component-inherit')(Child, Parent);

var childInstance = new Child();
childInstance.parentMethod(); // Now child has access to parentMethod

Other packages similar to component-inherit

Readme

Source

inherit

Prototype inheritance utility.

Installation

$ component install component/inherit

Example

var inherit = require('inherit');

function Human() {}
function Woman() {}

inherit(Woman, Human);

License

MIT

Keywords

FAQs

Last updated on 12 Feb 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc