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

pretty-format

Package Overview
Dependencies
Maintainers
6
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pretty-format - npm Package Compare versions

Comparing version 27.0.0-next.11 to 27.0.0

90

build/index.js

@@ -252,3 +252,7 @@ 'use strict';

? '[' + val.constructor.name + ']'
: (min ? '' : val.constructor.name + ' ') +
: (min
? ''
: !config.printBasicPrototype && val.constructor.name === 'Array'
? ''
: val.constructor.name + ' ') +
'[' +

@@ -300,3 +304,7 @@ (0, _collections.printListItems)(

? '[' + getConstructorName(val) + ']'
: (min ? '' : getConstructorName(val) + ' ') +
: (min
? ''
: !config.printBasicPrototype && getConstructorName(val) === 'Object'
? ''
: getConstructorName(val) + ' ') +
'{' +

@@ -413,2 +421,3 @@ (0, _collections.printObjectProperties)(

plugins: [],
printBasicPrototype: true,
printFunctionName: true,

@@ -491,35 +500,48 @@ theme: DEFAULT_THEME

const getConfig = options => ({
callToJSON:
options && options.callToJSON !== undefined
? options.callToJSON
: DEFAULT_OPTIONS.callToJSON,
colors:
options && options.highlight
? getColorsHighlight(options)
: getColorsEmpty(),
escapeRegex: getEscapeRegex(options),
escapeString: getEscapeString(options),
indent:
options && options.min
? ''
: createIndent(
options && options.indent !== undefined
? options.indent
: DEFAULT_OPTIONS.indent
),
maxDepth:
options && options.maxDepth !== undefined
? options.maxDepth
: DEFAULT_OPTIONS.maxDepth,
min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
plugins:
options && options.plugins !== undefined
? options.plugins
: DEFAULT_OPTIONS.plugins,
printFunctionName: getPrintFunctionName(options),
spacingInner: options && options.min ? ' ' : '\n',
spacingOuter: options && options.min ? '' : '\n'
});
const getConfig = options => {
var _options$printBasicPr;
return {
callToJSON:
options && options.callToJSON !== undefined
? options.callToJSON
: DEFAULT_OPTIONS.callToJSON,
colors:
options && options.highlight
? getColorsHighlight(options)
: getColorsEmpty(),
escapeRegex: getEscapeRegex(options),
escapeString: getEscapeString(options),
indent:
options && options.min
? ''
: createIndent(
options && options.indent !== undefined
? options.indent
: DEFAULT_OPTIONS.indent
),
maxDepth:
options && options.maxDepth !== undefined
? options.maxDepth
: DEFAULT_OPTIONS.maxDepth,
min:
options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
plugins:
options && options.plugins !== undefined
? options.plugins
: DEFAULT_OPTIONS.plugins,
printBasicPrototype:
(_options$printBasicPr =
options === null || options === void 0
? void 0
: options.printBasicPrototype) !== null &&
_options$printBasicPr !== void 0
? _options$printBasicPr
: true,
printFunctionName: getPrintFunctionName(options),
spacingInner: options && options.min ? ' ' : '\n',
spacingOuter: options && options.min ? '' : '\n'
};
};
function createIndent(indent) {

@@ -526,0 +548,0 @@ return new Array(indent + 1).join(' ');

@@ -55,2 +55,3 @@ /**

plugins: Plugins;
printBasicPrototype: boolean;
printFunctionName: boolean;

@@ -68,2 +69,3 @@ theme: Theme;

plugins?: Plugins;
printBasicPrototype?: boolean;
printFunctionName?: boolean;

@@ -81,2 +83,3 @@ theme?: ThemeReceived;

plugins: Plugins;
printBasicPrototype: boolean;
printFunctionName: boolean;

@@ -83,0 +86,0 @@ spacingInner: string;

{
"name": "pretty-format",
"version": "27.0.0-next.11",
"version": "27.0.0",
"repository": {

@@ -40,3 +40,3 @@ "type": "git",

},
"gitHead": "e2eb9aeee8aacd441f1c8ac992c698ac4d303f60"
"gitHead": "be16e47afcc9f64653b9a47782cb48a5ca243e65"
}

@@ -69,14 +69,15 @@ # pretty-format

<!-- prettier-ignore -->
| key | type | default | description |
| :------------------ | :-------- | :--------- | :------------------------------------------------------ |
| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects |
| `escapeRegex` | `boolean` | `false` | escape special characters in regular expressions |
| `escapeString` | `boolean` | `true` | escape special characters in strings |
| `highlight` | `boolean` | `false` | highlight syntax with colors in terminal (some plugins) |
| `indent` | `number` | `2` | spaces in each level of indentation |
| `maxDepth` | `number` | `Infinity` | levels to print in arrays, objects, elements, and so on |
| `min` | `boolean` | `false` | minimize added space: no indentation nor line breaks |
| `plugins` | `array` | `[]` | plugins to serialize application-specific data types |
| `printFunctionName` | `boolean` | `true` | include or omit the name of a function |
| `theme` | `object` | | colors to highlight syntax in terminal |
| key | type | default | description |
| :-------------------- | :-------- | :--------- | :------------------------------------------------------ |
| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects |
| `escapeRegex` | `boolean` | `false` | escape special characters in regular expressions |
| `escapeString` | `boolean` | `true` | escape special characters in strings |
| `highlight` | `boolean` | `false` | highlight syntax with colors in terminal (some plugins) |
| `indent` | `number` | `2` | spaces in each level of indentation |
| `maxDepth` | `number` | `Infinity` | levels to print in arrays, objects, elements, and so on |
| `min` | `boolean` | `false` | minimize added space: no indentation nor line breaks |
| `plugins` | `array` | `[]` | plugins to serialize application-specific data types |
| `printBasicPrototype` | `boolean` | `false` | print the prototype for plain objects and arrays |
| `printFunctionName` | `boolean` | `true` | include or omit the name of a function |
| `theme` | `object` | | colors to highlight syntax in terminal |

@@ -83,0 +84,0 @@ Property values of `theme` are from [ansi-styles colors](https://github.com/chalk/ansi-styles#colors)

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