📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
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.0.2
Source
npm
Version published
Weekly downloads
226K
-9.86%
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 16 Feb 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