{"library":"loupe","title":"Loupe Object Inspection Utility","description":"Loupe is a robust, cross-platform utility for converting JavaScript objects into string representations, designed to work consistently in both Node.js and browser environments. It provides functionality similar to Node.js' built-in `util.inspect()`, making it a valuable tool for debugging and generating human-readable output of complex data structures. The current stable major version is `4.x`, with `v4.0.0` introducing significant breaking changes regarding custom inspection methods. The package maintains a moderate release cadence, with minor and patch updates preceding major version increments, reflecting ongoing development and refinement. As a core component within the Chai.js assertion library ecosystem, Loupe's key differentiator is its unified inspection behavior across diverse JavaScript runtimes, addressing the common challenge of inconsistent object serialization.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install loupe"],"cli":null},"imports":["import { inspect } from 'loupe';","const { inspect } = require('loupe');","obj[Symbol('nodejs.util.inspect.custom')] = function() { /* ... */ };"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { inspect } from 'loupe';\n\n// Basic types\nconsole.log(inspect({ foo: 'bar', baz: 123 }));\nconsole.log(inspect([1, 'two', { three: 3 }]));\nconsole.log(inspect(new Date('2023-01-15T10:00:00Z')));\nconsole.log(inspect(/pattern/gi));\n\n// Functions\nfunction greet(name) { return `Hello, ${name}`; }\nconsole.log(inspect(greet));\n\n// Complex objects with custom inspection (v4.x compatible)\nconst customInspectable = {\n  value: 'secret',\n  [Symbol('nodejs.util.inspect.custom')]: function(depth, opts) {\n    return `CustomObject { value: '${this.value.slice(0, 3)}...' }`;\n  }\n};\nconsole.log(inspect(customInspectable));\n\n// Errors and Promises\nconst error = new Error('Something went wrong');\nconsole.log(inspect(error));\nconsole.log(inspect(Promise.resolve(42)));\n","lang":"typescript","description":"Demonstrates how to import and use the `inspect` function with various data types, including objects, arrays, dates, regexes, functions, and a custom-inspectable object (v4.x style).","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}