Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stdlib/utils-get-prototype-of

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/utils-get-prototype-of

Return the prototype of a provided object.

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
330K
decreased by-24.89%
Maintainers
4
Weekly downloads
 
Created

What is @stdlib/utils-get-prototype-of?

@stdlib/utils-get-prototype-of is a utility package that provides a function to get the prototype of an object. This can be useful in various scenarios such as inheritance checks, debugging, and understanding object structures.

What are @stdlib/utils-get-prototype-of's main functionalities?

Get Prototype of an Object

This feature allows you to retrieve the prototype of a given object. In this example, the prototype of an empty object is retrieved and logged to the console.

const getPrototypeOf = require('@stdlib/utils-get-prototype-of');
const obj = {};
const proto = getPrototypeOf(obj);
console.log(proto);

Check Inheritance

This feature can be used to check if an object inherits from a specific prototype. In this example, we create a parent and child constructor, set up inheritance, and then check if an instance of the child inherits from the parent's prototype.

const getPrototypeOf = require('@stdlib/utils-get-prototype-of');
function Parent() {}
function Child() {}
Child.prototype = Object.create(Parent.prototype);
const childInstance = new Child();
const isInherited = getPrototypeOf(childInstance) === Parent.prototype;
console.log(isInherited);

Other packages similar to @stdlib/utils-get-prototype-of

Keywords

FAQs

Package last updated on 16 Jun 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc