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

react-cosmos-shared2

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cosmos-shared2 - npm Package Compare versions

Comparing version 5.3.0 to 5.4.0-alpha.0

4

dist/react/areNodesEqual.d.ts

@@ -1,2 +0,2 @@

import React from 'react';
export declare function areNodesEqual(node1: React.ReactNode, node2: React.ReactNode, strictTypeCheck: boolean): boolean;
import { ReactNode } from 'react';
export declare function areNodesEqual(node1: ReactNode, node2: ReactNode, strictTypeCheck: boolean): boolean;

@@ -15,12 +15,5 @@ "use strict";

function areNodesEqual(node1, node2, strictTypeCheck) {
if ((0, _isReactElement.isReactElement)(node1) && (0, _isReactElement.isReactElement)(node2)) {
return areElementsEqual(node1, node2, strictTypeCheck);
}
if (Array.isArray(node1) && Array.isArray(node2)) {
return node1.every(function (node, nodeIndex) {
return areNodesEqual(node, node2[nodeIndex], strictTypeCheck);
});
}
if ((0, _isReactElement.isReactElement)(node1) && (0, _isReactElement.isReactElement)(node2)) return areElementsEqual(node1, node2, strictTypeCheck);
if (Array.isArray(node1) && Array.isArray(node2)) return areArrayNodesEqual(node1, node2, strictTypeCheck);
if (isObject(node1) && isObject(node2)) return areObjectsEqual(node1, node2);
return (0, _lodash.isEqual)(node1, node2);

@@ -30,15 +23,32 @@ }

function areElementsEqual(element1, element2, strictTypeCheck) {
if (strictTypeCheck) {
if (element1.type !== element2.type) {
return false;
}
} else if ((0, _getComponentName.getComponentName)(element1.type) !== (0, _getComponentName.getComponentName)(element2.type)) {
return false;
} // Don't compare private element attrs like _owner and _store, which hold
if (!areElementTypesEqual(element1.type, element2.type, strictTypeCheck)) return false; // Don't compare private element attrs like _owner and _store, which hold
// internal details and have auto increment-type attrs
return element1.key === element2.key && // @ts-ignore
element1.ref === element2.ref && // Children (and props in general) can contain Elements and other Nodes
areNodesEqual(element1.props, element2.props, strictTypeCheck);
}
function areElementTypesEqual(type1, type2, strictTypeCheck) {
return strictTypeCheck ? type1 === type2 : (0, _getComponentName.getComponentName)(type1) === (0, _getComponentName.getComponentName)(type2);
}
function areArrayNodesEqual(node1, node2, strictTypeCheck) {
if (node1.length !== node2.length) return false;
return node1.every(function (node, nodeIndex) {
return areNodesEqual(node, node2[nodeIndex], strictTypeCheck);
});
}
function isObject(node) {
return (0, _lodash.isPlainObject)(node);
}
function areObjectsEqual(object1, object2) {
if (!(0, _lodash.isEqual)(Object.keys(object1), Object.keys(object2))) return false;
return Object.keys(object1).every(function (key) {
return (0, _lodash.isEqualWith)(object1[key], object2[key], function (value1, value2) {
return typeof value1 === 'function' && typeof value2 === 'function' ? value1 === value2 || value1.toString() === value2.toString() : (0, _lodash.isEqual)(value1, value2);
});
});
}
{
"name": "react-cosmos-shared2",
"version": "5.3.0",
"version": "5.4.0-alpha.0",
"description": "Code shared between Cosmos packages",

@@ -14,3 +14,3 @@ "repository": "https://github.com/react-cosmos/react-cosmos/tree/master/packages/react-cosmos-shared2",

},
"gitHead": "e7ab2d4c33fefaa38bd433a0972a03a7d1fcf125"
"gitHead": "8d8f79c4a28755b755f4c1915d4f43d2915d1df1"
}
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