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

@devtools-ds/object-inspector

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devtools-ds/object-inspector

An emulation of the Chrome and Firefox object inspector, which allows you to view JavaScript objects in the console.

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
256K
decreased by-10.24%
Maintainers
1
Weekly downloads
 
Created

What is @devtools-ds/object-inspector?

@devtools-ds/object-inspector is a React component library designed to help developers inspect and visualize JavaScript objects in a structured and interactive manner. It is particularly useful for debugging and development tools, providing a user-friendly interface to explore complex data structures.

What are @devtools-ds/object-inspector's main functionalities?

Basic Object Inspection

This feature allows you to inspect a basic JavaScript object. The ObjectInspector component takes a data prop and renders it in a tree-like structure, making it easy to explore nested properties.

import { ObjectInspector } from '@devtools-ds/object-inspector';

const data = {
  name: 'John Doe',
  age: 30,
  address: {
    street: '123 Main St',
    city: 'Anytown',
    country: 'USA'
  }
};

const App = () => (
  <ObjectInspector data={data} />
);

Custom Node Renderer

This feature allows you to customize how each node in the object tree is rendered. By providing a custom nodeRenderer function, you can control the appearance and behavior of each node.

import { ObjectInspector, chromeLight } from '@devtools-ds/object-inspector';

const data = {
  name: 'John Doe',
  age: 30,
  address: {
    street: '123 Main St',
    city: 'Anytown',
    country: 'USA'
  }
};

const customNodeRenderer = ({ depth, name, data, isNonenumerable }) => (
  <span style={{ marginLeft: depth * 10 }}>
    {name}: {typeof data === 'object' ? JSON.stringify(data) : data}
  </span>
);

const App = () => (
  <ObjectInspector data={data} nodeRenderer={customNodeRenderer} theme={chromeLight} />
);

Theming Support

This feature allows you to apply different themes to the ObjectInspector component. The package comes with several built-in themes like chromeLight and chromeDark, which can be applied by passing the theme prop.

import { ObjectInspector, chromeDark } from '@devtools-ds/object-inspector';

const data = {
  name: 'John Doe',
  age: 30,
  address: {
    street: '123 Main St',
    city: 'Anytown',
    country: 'USA'
  }
};

const App = () => (
  <ObjectInspector data={data} theme={chromeDark} />
);

Other packages similar to @devtools-ds/object-inspector

FAQs

Package last updated on 27 Dec 2022

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