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

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 29.0.0-alpha.6 to 29.0.0

3

build/collections.js

@@ -19,3 +19,4 @@ 'use strict';

const getKeysOfEnumerableProperties = (object, compareKeys) => {
const keys = Object.keys(object).sort(compareKeys);
const rawKeys = Object.keys(object);
const keys = compareKeys !== null ? rawKeys.sort(compareKeys) : rawKeys;

@@ -22,0 +23,0 @@ if (Object.getOwnPropertySymbols) {

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

| ((a: string, b: string) => number)
| null
| undefined;

@@ -54,3 +55,25 @@

export declare const DEFAULT_OPTIONS: Options;
export declare const DEFAULT_OPTIONS: {
callToJSON: true;
compareKeys: undefined;
escapeRegex: false;
escapeString: true;
highlight: false;
indent: number;
maxDepth: number;
maxWidth: number;
min: false;
plugins: never[];
printBasicPrototype: true;
printFunctionName: true;
theme: Required<
Partial<{
readonly comment: string;
readonly content: string;
readonly prop: string;
readonly tag: string;
readonly value: string;
}>
>;
};

@@ -119,3 +142,4 @@ /**

export declare interface PrettyFormatOptions extends SnapshotFormat {
export declare interface PrettyFormatOptions
extends Omit<SnapshotFormat, 'compareKeys'> {
compareKeys?: CompareKeys;

@@ -122,0 +146,0 @@ plugins?: Plugins;

@@ -399,4 +399,7 @@ 'use strict';

};
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
const DEFAULT_OPTIONS = {
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME); // could be replaced by `satisfies` operator in the future: https://github.com/microsoft/TypeScript/issues/47920
const toOptionsSubtype = options => options;
const DEFAULT_OPTIONS = toOptionsSubtype({
callToJSON: true,

@@ -415,3 +418,3 @@ compareKeys: undefined,

theme: DEFAULT_THEME
};
});
exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS;

@@ -490,3 +493,3 @@

compareKeys:
typeof options?.compareKeys === 'function'
typeof options?.compareKeys === 'function' || options?.compareKeys === null
? options.compareKeys

@@ -493,0 +496,0 @@ : DEFAULT_OPTIONS.compareKeys,

@@ -34,3 +34,3 @@ /**

export declare type Theme = Options['theme'];
export declare type CompareKeys = ((a: string, b: string) => number) | undefined;
export declare type CompareKeys = ((a: string, b: string) => number) | null | undefined;
declare type RequiredOptions = Required<PrettyFormatOptions>;

@@ -41,3 +41,3 @@ export interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> {

}
export interface PrettyFormatOptions extends SnapshotFormat {
export interface PrettyFormatOptions extends Omit<SnapshotFormat, 'compareKeys'> {
compareKeys?: CompareKeys;

@@ -44,0 +44,0 @@ plugins?: Plugins;

{
"name": "pretty-format",
"version": "29.0.0-alpha.6",
"version": "29.0.0",
"repository": {

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

"dependencies": {
"@jest/schemas": "^29.0.0-alpha.3",
"@jest/schemas": "^29.0.0",
"ansi-styles": "^5.0.0",

@@ -31,5 +31,5 @@ "react-is": "^18.0.0"

"@types/react-test-renderer": "17.0.2",
"expect": "^29.0.0-alpha.6",
"expect": "^29.0.0",
"immutable": "^4.0.0",
"jest-util": "^29.0.0-alpha.6",
"jest-util": "^29.0.0",
"react": "17.0.2",

@@ -45,3 +45,3 @@ "react-dom": "^17.0.1",

},
"gitHead": "4def94b073cad300e99de378ba900e6ba9b7032f"
"gitHead": "75006e46c76f6fda14bbc0548f86edb2ba087cd2"
}

@@ -69,17 +69,17 @@ # pretty-format

<!-- prettier-ignore -->
| key | type | default | description |
| :-------------------- | :-------- | :--------- | :------------------------------------------------------ |
| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects |
| `compareKeys` | `function`| `undefined`| compare function used when sorting object keys |
| `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 |
| `maxWidth` | `number` | `Infinity` | number of elements to print in arrays, sets, 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 |
| key | type | default | description |
| :-------------------- | :--------------- | :---------- | :-------------------------------------------------------------------------------------- |
| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects |
| `compareKeys` | `function\|null` | `undefined` | compare function used when sorting object keys, `null` can be used to skip over sorting |
| `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 |
| `maxWidth` | `number` | `Infinity` | number of elements to print in arrays, sets, 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 |

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

<!-- prettier-ignore -->
| key | type | description |
| :------------------ | :-------- | :------------------------------------------------------ |
| `callToJSON` | `boolean` | call `toJSON` method (if it exists) on objects |
| `compareKeys` | `function`| compare function used when sorting object keys |
| `colors` | `Object` | escape codes for colors to highlight syntax |
| `escapeRegex` | `boolean` | escape special characters in regular expressions |
| `escapeString` | `boolean` | escape special characters in strings |
| `indent` | `string` | spaces in each level of indentation |
| `maxDepth` | `number` | levels to print in arrays, objects, elements, and so on |
| `min` | `boolean` | minimize added space: no indentation nor line breaks |
| `plugins` | `array` | plugins to serialize application-specific data types |
| `printFunctionName` | `boolean` | include or omit the name of a function |
| `spacingInner` | `string` | spacing to separate items in a list |
| `spacingOuter` | `string` | spacing to enclose a list of items |
| key | type | description |
| :------------------ | :--------------- | :-------------------------------------------------------------------------------------- |
| `callToJSON` | `boolean` | call `toJSON` method (if it exists) on objects |
| `compareKeys` | `function\|null` | compare function used when sorting object keys, `null` can be used to skip over sorting |
| `colors` | `Object` | escape codes for colors to highlight syntax |
| `escapeRegex` | `boolean` | escape special characters in regular expressions |
| `escapeString` | `boolean` | escape special characters in strings |
| `indent` | `string` | spaces in each level of indentation |
| `maxDepth` | `number` | levels to print in arrays, objects, elements, and so on |
| `min` | `boolean` | minimize added space: no indentation nor line breaks |
| `plugins` | `array` | plugins to serialize application-specific data types |
| `printFunctionName` | `boolean` | include or omit the name of a function |
| `spacingInner` | `string` | spacing to separate items in a list |
| `spacingOuter` | `string` | spacing to enclose a list of items |

@@ -226,0 +226,0 @@ Each property of `colors` in `config` corresponds to a property of `theme` in `options`:

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