Socket
Socket
Sign inDemoInstall

pretty-format

Package Overview
Dependencies
Maintainers
3
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 30.0.0-alpha.2 to 30.0.0-alpha.3

10

build/index.d.ts

@@ -69,7 +69,7 @@ /**

theme: Required<{
readonly comment?: string | undefined;
readonly content?: string | undefined;
readonly prop?: string | undefined;
readonly tag?: string | undefined;
readonly value?: string | undefined;
comment?: string | undefined;
content?: string | undefined;
prop?: string | undefined;
tag?: string | undefined;
value?: string | undefined;
}>;

@@ -76,0 +76,0 @@ };

@@ -216,3 +216,3 @@ /*!

if (typeof val.toAsymmetricMatcher !== 'function') {
throw new Error(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
}

@@ -250,5 +250,5 @@ return val.toAsymmetricMatcher();

const SPACE = ' ';
const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
const OBJECT_NAMES = new Set(['DOMStringMap', 'NamedNodeMap']);
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
const testName = name => OBJECT_NAMES.includes(name) || ARRAY_REGEXP.test(name);
const testName = name => OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
const test = val => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);

@@ -262,3 +262,3 @@ exports.test = test;

}
return (config.min ? '' : name + SPACE) + (OBJECT_NAMES.includes(name) ? `{${(0, _collections.printObjectProperties)(isNamedNodeMap(collection) ? Array.from(collection).reduce((props, attribute) => {
return (config.min ? '' : name + SPACE) + (OBJECT_NAMES.has(name) ? `{${(0, _collections.printObjectProperties)(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
props[attribute.name] = attribute.value;

@@ -268,3 +268,3 @@ return props;

...collection
}, config, indentation, depth, refs, printer)}}` : `[${(0, _collections.printListItems)(Array.from(collection), config, indentation, depth, refs, printer)}]`);
}, config, indentation, depth, refs, printer)}}` : `[${(0, _collections.printListItems)([...collection], config, indentation, depth, refs, printer)}]`);
};

@@ -340,3 +340,3 @@ exports.serialize = serialize;

}
return (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes, attr => attr.name).sort(), nodeIsFragment(node) ? {} : Array.from(node.attributes).reduce((props, attribute) => {
return (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes, attr => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
props[attribute.name] = attribute.value;

@@ -609,3 +609,3 @@ return props;

function escapeHTML(str) {
return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
return str.replaceAll('<', '&lt;').replaceAll('>', '&gt;');
}

@@ -807,3 +807,3 @@

if (escapeString) {
return `"${val.replace(/"|\\/g, '\\$&')}"`;
return `"${val.replaceAll(/"|\\/g, '\\$&')}"`;
}

@@ -832,3 +832,3 @@ return `"${val}"`;

if (toStringed === '[object Date]') {
return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
return Number.isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
}

@@ -841,3 +841,3 @@ if (toStringed === '[object Error]') {

// https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js
return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&');
}

@@ -860,3 +860,3 @@ return regExpToString.call(val);

}
refs = refs.slice();
refs = [...refs];
refs.push(val);

@@ -894,3 +894,3 @@ const hitMaxDepth = ++depth > config.maxDepth;

const indentationNext = indentation + config.indent;
return indentationNext + str.replace(NEWLINE_REGEXP, `\n${indentationNext}`);
return indentationNext + str.replaceAll(NEWLINE_REGEXP, `\n${indentationNext}`);
}, {

@@ -905,3 +905,3 @@ edgeSpacing: config.spacingOuter,

if (typeof printed !== 'string') {
throw new Error(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
}

@@ -911,6 +911,6 @@ return printed;

function findPlugin(plugins, val) {
for (let p = 0; p < plugins.length; p++) {
for (const plugin of plugins) {
try {
if (plugins[p].test(val)) {
return plugins[p];
if (plugin.test(val)) {
return plugin;
}

@@ -952,4 +952,4 @@ } catch (error) {

indent: 2,
maxDepth: Infinity,
maxWidth: Infinity,
maxDepth: Number.POSITIVE_INFINITY,
maxWidth: Number.POSITIVE_INFINITY,
min: false,

@@ -975,3 +975,3 @@ plugins: [],

if (typeof options.theme !== 'object') {
throw new Error(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`);
throw new TypeError(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`);
}

@@ -1017,3 +1017,5 @@ }

function createIndent(indent) {
return new Array(indent + 1).join(' ');
return Array.from({
length: indent + 1
}).join(' ');
}

@@ -1020,0 +1022,0 @@

{
"name": "pretty-format",
"version": "30.0.0-alpha.2",
"version": "30.0.0-alpha.3",
"repository": {

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

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

@@ -34,3 +34,3 @@ "react-is": "^18.0.0"

"immutable": "^4.0.0",
"jest-util": "30.0.0-alpha.2",
"jest-util": "30.0.0-alpha.3",
"react": "18.2.0",

@@ -46,3 +46,3 @@ "react-dom": "18.2.0",

},
"gitHead": "c04d13d7abd22e47b0997f6027886aed225c9ce4"
"gitHead": "e267aff33d105399f2134bad7c8f82285104f3da"
}
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