Socket
Socket
Sign inDemoInstall

pretty-format

Package Overview
Dependencies
Maintainers
5
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 21.0.0-alpha.1 to 21.0.0-alpha.2

100

build/plugins/immutable.js

@@ -23,5 +23,8 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.test = exports.serialize = undefined;

*
*/const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // v4 or later
const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';const getImmutableName = name => 'Immutable.' + name;
*/const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
const getImmutableName = name => 'Immutable.' + name;
const printAsLeaf = name => '[' + name + ']';
const SPACE = ' ';
const LAZY = '…'; // Seq is lazy if it calls a method like filter

@@ -38,7 +41,6 @@ const printImmutableEntries = (

++depth > config.maxDepth ?
'[' + getImmutableName(type) + ']' :
printAsLeaf(getImmutableName(type)) :
getImmutableName(type) +
SPACE +
'{' + (
val.size !== 0 ?
'{' +
(0, _collections.printIteratorEntries)(

@@ -50,5 +52,4 @@ val.entries(),

refs,
printer) :
printer) +
config.spacingOuter + indentation) +
'}';

@@ -81,24 +82,69 @@

const name = getImmutableName(val._name || 'Record');
const size = Array.isArray(val._keys) ? val._keys.length : val.size;
const entries = typeof Array.isArray(val._keys) ?
getRecordEntries(val) // v4 or later
: val.entries(); // v3 or earlier
getRecordEntries(val) // immutable v4
: val.entries(); // Record is a collection in immutable v3
return ++depth > config.maxDepth ?
'[' + name + ']' :
printAsLeaf(name) :
name +
SPACE +
'{' + (
size !== 0 ?
(0, _collections.printIteratorEntries)(
entries,
config,
indentation,
depth,
refs,
printer) :
config.spacingOuter + indentation) +
'{' +
(0, _collections.printIteratorEntries)(entries, config, indentation, depth, refs, printer) +
'}';
};
const printImmutableSeq = (
val,
config,
indentation,
depth,
refs,
printer) =>
{
const name = getImmutableName('Seq');
if (++depth > config.maxDepth) {
return printAsLeaf(name);
}
if (val[IS_KEYED_SENTINEL]) {
return (
name +
SPACE +
'{' + (
// from Immutable collection of entries or from ECMAScript object
val._iter || val._object ?
(0, _collections.printIteratorEntries)(
val.entries(),
config,
indentation,
depth,
refs,
printer) :
LAZY) +
'}');
}
return (
name +
SPACE +
'[' + (
val._iter || // from Immutable collection of values
val._array || // from ECMAScript array
val._collection || // from ECMAScript collection in immutable v4
val._iterable // from ECMAScript collection in immutable v3
? (0, _collections.printIteratorValues)(
val.values(),
config,
indentation,
depth,
refs,
printer) :
LAZY) +
']');
};
const printImmutableValues = (

@@ -114,7 +160,6 @@ val,

++depth > config.maxDepth ?
'[' + getImmutableName(type) + ']' :
printAsLeaf(getImmutableName(type)) :
getImmutableName(type) +
SPACE +
'[' + (
val.size !== 0 ?
'[' +
(0, _collections.printIteratorValues)(

@@ -126,5 +171,4 @@ val.values(),

refs,
printer) :
printer) +
config.spacingOuter + indentation) +
']';

@@ -187,3 +231,3 @@

if (val[IS_SEQ_SENTINEL]) {
return '[' + getImmutableName('Seq') + ']';
return printImmutableSeq(val, config, indentation, depth, refs, printer);
}

@@ -190,0 +234,0 @@

{
"name": "pretty-format",
"version": "21.0.0-alpha.1",
"version": "21.0.0-alpha.2",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

Sorry, the diff of this file is too big to display

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