npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

v-object-inspector

v0.1.3

Published

<a href="https://www.npmjs.com/package/v-object-inspector"> <img alt="Commitizen friendly" src="https://img.shields.io/npm/v/v-object-inspector"> </a> <a href="https://www.npmtrends.com/v-object-inspector"> <img alt="Commitizen friendly" src="http

Downloads

17

Readme

v-object-inspector

A Vue 3 component for displaying JavaScript objects like Browser DevTools (live demo).

This repository is a rewrite of vue-object-inspector with Vue 3 and TypeScript.

Installation

npm install v-object-inspector

Usage Example

Register as a global component:

import { createApp } from 'vue'
import VObjectInspector from 'v-object-inspector'
import App from './App.vue'

const app = createApp(App)
app.use(VObjectInspector)
app.mount('#app')

Or import locally:

<script setup lang="ts">
import { VObjectInspector } from 'v-object-inspector'
</script>

<template>
  <VObjectInspector :data="{ a: 1, b: 2 }" />
</template>

VObjectInspector API

| Name | Description | Type | Default | Required | | ------------------------------------------- | -------------------------------------------------------------- | --------------------- | ------- | -------- | | data | the JavaScript object to inspect | any | — | true | | name | the root node's prefix name | string | — | false | | expandLevel | the depth level to which the tree should be initially expanded | number | 0 | false | | expandedPaths | the paths in the tree that should be initially expanded | string[] | [] | false | | showNonEnumerable | whether to show non-enumerable properties | boolean | false | false | | sortObjectKeys | whether to sort object keys | boolean \| function | false | false | | objectMaxProperties | the maximal number of object properties to show in preview | number | 5 | false | | arrayMaxProperties | the maximal number of array properties to show in preview | number | 10 | false | | darkTheme | whether to use the dark theme or the light theme | boolean | false | false |

data

  • Description: JavaScript object to inspect
  • Type: any
  • Default: —
  • Required: true

name

  • Description: the root node's prefix name
  • Type: string
  • Default: —
  • Required: false

expandLevel

  • Description: the depth level to which the tree should be initially expanded
  • Type: number
  • Default: 0
  • Required: false
  • Note: the root node has level 0 and its children have level 1
  • Scenarios:
    • If want to expand all level, change expandLevel to a very big number.
    • If want to collapse all level, change expandLevel to 0.
    • If already change expand by hand, change the expandLevel to a negative number, then change it back in $nextTick.

expandPaths

  • Description: the paths in the tree that should be initially expanded
  • Type: string[]
  • Default: []
  • Required: false
  • Note: a path string in the expandPaths array follows the syntax like JSONPath
  • Examples:
    • ['$']: expand root node, $ always refers to the root node
    • ['$.myKey']: expand to myKey node (will also expand all parent nodes)
    • ['$.myKey.myArr']: expand to myArr node (will also expand all parent nodes)
    • ['$.a', '$.b']: expand first level nodes a and b
    • ['$.1']: expand by array index
    • ['$.*']: wildcard, expand all level 2 nodes, equivalent to :expandLevel="2"
    • ['$.*.*']: wildcard, expand all level 3 nodes, equivalent to :expandLevel="3"

expandLevel vs expandPaths

Both expandLevel and expandPaths are reactive. Try avoid using both expandLevel and expandPaths at the same time. If expandLevel and expandPaths are used together, when one of them changes, only the changed one will take effect and the other one will be ignored.

showNonEnumerable

  • Description: whether to show non-enumerable properties (e.g., __proto__, length, and constructor)
  • Type: boolean
  • Default: false
  • Required: false

sortObjectKeys

  • Description: whether to sort object keys
  • Type: boolean | function
  • Default: false
  • Required: false
  • Note: when a compare function is passed, the keys will be sorted as Array.sort() with a compared function
  • Examples:
    • true: sort object keys in alphabetical order (except for arrays)
    • reverseSortFunc: sort in reverse alphabetical order (except for arrays)
      const reverseSortFunc = (a, b) => (b > a ? 1 : -1)

objectMaxProperties

  • Description: the maximal number of object properties to show in preview
  • Type: number
  • Default: 5
  • Required: false

arrayMaxProperties

  • Description: the maximal number of array properties to show in preview
  • Type: number
  • Default: 10
  • Required: false

darkTheme

  • Description: whether to use the dark theme or the light theme
  • Type: boolean
  • Default: false
  • Required: false

Thanks