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

deep-eq

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-eq - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

12

index.js

@@ -17,3 +17,3 @@ const prettyFormat = require('pretty-format');

const listStyle = chalk.blueBright('\n → ');
const maybeInline = s => (s.includes('\n') ? '\n' : ' ') + s;

@@ -26,13 +26,13 @@ const deepEqual = (o1, o2) => {

const v1 = o1[key], v2 = o2[key];
const keyStr = chalk.blueBright(`${path.concat(key).join('.')}`);
const keyStr = path.concat(key).join('.')
if (v1 === undefined && v2 === undefined) {
// ignore
} else if (v1 === undefined) {
diffs.push(`${keyStr}:\n${chalk.greenBright(format(v2))}`);
diffs.push(`${chalk.bold.red('\n → ' + keyStr)}:${maybeInline(chalk.magentaBright(format(v2)))}`);
} else if (v2 === undefined) {
diffs.push(`${keyStr}:\n${chalk.redBright(format(v1))}`);
diffs.push(`${chalk.bold.red('\n ← ' + keyStr)}:${maybeInline(chalk.magenta(format(v1)))}`);
} else if (v1 && typeof v1 === 'object' && v2 && typeof v2 === 'object') {
deepEq(v1, v2, path.concat(key));
} else if (v1 !== v2) {
diffs.push(`${keyStr}:\n${chalk.greenBright(format(v1))} !== ${chalk.redBright(format(v2))}`);
diffs.push(`${chalk.bold.red('\n ↔ ' + keyStr)}:${maybeInline(`${chalk.magenta(format(v1))} !== ${chalk.magentaBright(format(v2))}`)}`);
}

@@ -44,5 +44,5 @@ });

throw new AssertionError(listStyle + diffs.join(listStyle));
throw new AssertionError(diffs.join(''));
};
module.exports = deepEqual;
{
"name": "deep-eq",
"version": "1.0.1",
"version": "1.1.0",
"description": "deepEqual assertion with pretty diff",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,4 +16,3 @@ # deep-eq

AssertionError:
→ foo.ok:
1 !== 2
↔ foo.ok: 1 !== 2
at ....

@@ -20,0 +19,0 @@ ```

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