Socket
Socket
Sign inDemoInstall

q-i

Package Overview
Dependencies
8
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

18

index.js

@@ -5,3 +5,2 @@ const _ = require('lodash');

const maxItems = 30;
const internals = ['Array', 'Object', 'Function'];

@@ -38,3 +37,14 @@

function stringify(object) {
function stringify(object, addr, options) {
if (addr) {
if (!options && _.isPlainObject(addr)) {
options = addr;
addr = undefined;
} else {
object = _.get(object, addr);
}
}
const { maxItems = 30 } = options || {};
return stringifyObject(object, {

@@ -70,5 +80,5 @@ indent: ' ',

function print(object) {
function print(object, addr, options) {
// eslint-disable-next-line no-console
console.log(stringify(object));
console.log(stringify(object, addr, options));
}

@@ -75,0 +85,0 @@

{
"name": "q-i",
"version": "1.0.0",
"description": "quickly inspect Node.js objects",
"version": "1.1.0",
"description": "Node.js objects inspector with color highlighting",
"author": {

@@ -13,3 +13,3 @@ "name": "Artem Sapegin",

"engines": {
"node": ">=4"
"node": ">=6"
},

@@ -26,3 +26,4 @@ "main": "index.js",

"test:coverage": "jest --coverage",
"test": "npm run test:jest"
"test": "npm run test:jest",
"precommit": "lint-staged"
},

@@ -38,3 +39,6 @@ "keywords": [

"stringify",
"json"
"json",
"color",
"syntax",
"highlight"
],

@@ -45,3 +49,5 @@ "devDependencies": {

"eslint-plugin-prettier": "^2.3.1",
"husky": "^0.14.3",
"jest": "^21.1.0",
"lint-staged": "^4.2.1",
"prettier": "^1.7.0"

@@ -53,3 +59,14 @@ },

"stringify-object": "^3.2.0"
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
]
},
"release": {
"analyzeCommits": "semantic-release-tamia/analyzeCommits",
"generateNotes": "semantic-release-tamia/generateNotes",
"verifyRelease": "semantic-release-tamia/verifyRelease"
}
}
}

@@ -1,5 +0,17 @@

# q-i: quickly inspect Node.js objects
# q-i: Node.js objects inspector with color highlighting
[![npm](https://img.shields.io/npm/v/q-i.svg)](https://www.npmjs.com/package/q-i)
[![Build Status](https://travis-ci.org/sapegin/q-i.svg)](https://travis-ci.org/sapegin/q-i)
Useful for debugging big objects, like webpack configuration.
![](https://d3vv6lp55qjaqc.cloudfront.net/items/0S1R2F1u1i1E2h2z0R41/q-i.png)
## Features
* Compact and readable output
* No unnecessary quotes
* Color highlighted
* Collapses huge arrays and objects (more than 30 items by default)
## Installation

@@ -16,6 +28,41 @@

print({ a: 42 });
console.log(stringify({ a: 42 }));
const obj = { a: { x: 41, y: { z: 42 } } };
// Print whole object
print(obj);
console.log(stringify(obj));
/* =>
{
a: {
x: 41,
y: {
z: 42
}
}
}
*/
// Print part of an object
print(obj, 'a.y');
console.log(stringify(obj, 'a.y'));
/* =>
{
z: 42
}
*/
```
## Options
```js
print(obj, { maxItems: Infinity })
print(obj, 'a.y', { maxItems: Infinity })
stringify(obj, { maxItems: Infinity })
stringify(obj, 'a.y', { maxItems: Infinity })
```
### `maxItems` (default: 30)
Collapse arrays with more than `maxItems` items and objects with more than `maxItems` keys.
## Change log

@@ -22,0 +69,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc