Socket
Socket
Sign inDemoInstall

loupe

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loupe

Inspect utility for Node.js and browsers


Version published
Weekly downloads
12M
increased by7.43%
Maintainers
1
Weekly downloads
 
Created

What is loupe?

The loupe npm package is a library that allows you to inspect JavaScript objects in a detailed and structured way. It is particularly useful for debugging and understanding complex structures by providing a clear visualization of the object's properties, including those that are not enumerable or are inherited through the prototype chain.

What are loupe's main functionalities?

Inspecting objects

This feature allows you to inspect JavaScript objects and see their structure and contents in a human-readable format. The code sample demonstrates how to use loupe to inspect a simple object.

const loupe = require('loupe');
console.log(loupe({ a: 1, b: { c: 2 } }));

Inspecting arrays

Loupe can also be used to inspect arrays, including nested arrays, to visualize their contents and structure.

const loupe = require('loupe');
console.log(loupe([1, 2, 3, [4, 5]]));

Inspecting functions

This feature is useful for inspecting functions, including their name, length (number of expected arguments), and code. The code sample shows how to inspect a simple function.

const loupe = require('loupe');
function exampleFunction() { return true; }
console.log(loupe(exampleFunction));

Inspecting prototypes

Loupe can inspect objects and their prototypes, revealing inherited properties. The code sample demonstrates inspecting an instance of a custom class.

const loupe = require('loupe');
function MyClass() { this.a = 1; }
MyClass.prototype.b = 2;
console.log(loupe(new MyClass()));

Other packages similar to loupe

FAQs

Package last updated on 07 Oct 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