Socket
Socket
Sign inDemoInstall

apollo-utilities

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-utilities - npm Package Compare versions

Comparing version 0.2.0-alpha.6 to 0.2.0-beta.0

9

lib/util/isEqual.js

@@ -7,2 +7,5 @@ "use strict";

}
if (a instanceof Date && b instanceof Date) {
return a.getTime() === b.getTime();
}
if (a != null &&

@@ -13,4 +16,4 @@ typeof a === 'object' &&

for (var key in a) {
if (a.hasOwnProperty(key)) {
if (!b.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(a, key)) {
if (!Object.prototype.hasOwnProperty.call(b, key)) {
return false;

@@ -24,3 +27,3 @@ }

for (var key in b) {
if (!a.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(a, key)) {
return false;

@@ -27,0 +30,0 @@ }

{
"name": "apollo-utilities",
"version": "0.2.0-alpha.6",
"version": "0.2.0-beta.0",
"description": "Utilities for working with GraphQL ASTs",

@@ -5,0 +5,0 @@ "author": "James Baxley <james@meteor.com>",

@@ -65,2 +65,23 @@ import { isEqual } from '../isEqual';

});
it('should correctly compare deep objects without object prototype ', () => {
// Solves https://github.com/apollographql/apollo-client/issues/2132
const objNoProto = Object.create(null);
objNoProto.a = { b: 2, c: [3, 4] };
objNoProto.e = Object.create(null);
objNoProto.e.f = 5;
expect(isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 5 } })).toBe(
true,
);
expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 6 } })).toBe(
true,
);
expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: null })).toBe(
true,
);
expect(!isEqual(objNoProto, { a: { b: 2, c: [3] }, e: { f: 5 } })).toBe(
true,
);
expect(!isEqual(objNoProto, null)).toBe(true);
});
});

@@ -9,2 +9,6 @@ /**

}
// Dates are equivalent if their time values are equal.
if (a instanceof Date && b instanceof Date) {
return a.getTime() === b.getTime();
}
// If a and b are both objects, we will compare their properties. This will compare arrays as

@@ -21,4 +25,4 @@ // well.

for (const key in a) {
if (a.hasOwnProperty(key)) {
if (!b.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(a, key)) {
if (!Object.prototype.hasOwnProperty.call(b, key)) {
return false;

@@ -33,3 +37,3 @@ }

for (const key in b) {
if (!a.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(a, key)) {
return false;

@@ -36,0 +40,0 @@ }

Sorry, the diff of this file is not supported yet

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