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

tcompare

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcompare - npm Package Compare versions

Comparing version 2.3.0 to 3.0.0

5

lib/format.js

@@ -256,3 +256,6 @@ class Format {

arrayIsEmpty () {
return this.object.length === 0
const obj = Array.isArray(this.object)
? this.object : Array.from(this.object)
return obj.length === 0
}

@@ -259,0 +262,0 @@ arrayEmpty () {

6

lib/has.js

@@ -5,5 +5,2 @@ const Same = require('./same.js')

arrayBody () {
if (this.object.length === this.expect.length)
return super.arrayBody()
const obj = Array.isArray(this.object)

@@ -15,2 +12,5 @@ ? this.object : Array.from(this.object)

if (obj.length === exp.length)
return super.arrayBody()
// only need to handle missing values, not extra ones

@@ -17,0 +17,0 @@ let out = ''

const Format = require('./format.js')
const frag = require('diff-frag')

@@ -70,3 +71,3 @@ class Same extends Format {

if (!this.options.cleanerDiffs)
return pretty.concat(difflines).join('\n')
return frag(pretty.concat(difflines).join('\n'))

@@ -97,3 +98,3 @@ // unsure on whether this is a good idea.

pretty.push.apply(pretty, hunkp)
return pretty.join('\n')
return frag(pretty.join('\n'))
}

@@ -192,6 +193,2 @@

arrayBody () {
// just need to handle extra/missing values
if (this.object.length === this.expect.length)
return super.arrayBody()
const obj = Array.isArray(this.object)

@@ -203,2 +200,6 @@ ? this.object : Array.from(this.object)

// just need to handle extra/missing values
if (obj.length === exp.length)
return super.arrayBody()
let out = ''

@@ -413,2 +414,4 @@ let key = 0

childExpect (key) {
const exp = this.isArray() && !Array.isArray(this.expect)
? Array.from(this.expect) : this.expect
// if we get here, we know that both expect and actual

@@ -419,3 +422,3 @@ // are collections of the same type. Otherwise, they

: this.isMap() ? this.expect.get(key)
: this.isArray() ? this.expect[key]
: this.isArray() ? exp[key]
: this.expect[key]

@@ -422,0 +425,0 @@ }

{
"name": "tcompare",
"version": "2.3.0",
"version": "3.0.0",
"description": "A comprehensive comparison library, for use in test frameworks",

@@ -17,3 +17,3 @@ "main": "index.js",

"devDependencies": {
"tap": "^13.1.7"
"tap": "^14.9.2"
},

@@ -30,3 +30,6 @@ "scripts": {

"coverage-map": "map.js"
},
"dependencies": {
"diff-frag": "^1.0.1"
}
}
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