Socket
Socket
Sign inDemoInstall

@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.


Version published
Weekly downloads
472K
decreased by-0.24%
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 27 Jul 2024

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