Comparing version 2.2.0 to 2.3.0
@@ -6,2 +6,3 @@ class Format { | ||
this.memo = null | ||
this.sort = !!options.sort | ||
@@ -316,5 +317,5 @@ // matching object circularity needs to be handled differently, | ||
pojoBody () { | ||
const ent = Object.entries(this.object) | ||
const ent = this.pojoEntries(this.object) | ||
let out = '' | ||
for (const [key, val] of Object.entries(this.object)) { | ||
for (const [key, val] of ent) { | ||
out += this.pojoEntry(key, val) | ||
@@ -324,2 +325,6 @@ } | ||
} | ||
pojoEntries (object) { | ||
const ent = Object.entries(object) | ||
return this.sort ? ent.sort((a, b) => a[0].localeCompare(b[0])) : ent | ||
} | ||
pojoTail () { | ||
@@ -326,0 +331,0 @@ return `${this.indentLevel()}${this.style.pojoTail()}` |
@@ -162,3 +162,3 @@ const Same = require('./same.js') | ||
pojoBody () { | ||
const expEnt = Object.entries(this.expect) | ||
const expEnt = this.pojoEntries(this.expect) | ||
@@ -165,0 +165,0 @@ let out = '' |
@@ -367,4 +367,4 @@ const Format = require('./format.js') | ||
pojoBody () { | ||
const objEnt = Object.entries(this.object) | ||
const expEnt = Object.entries(this.expect) | ||
const objEnt = this.pojoEntries(this.object) | ||
const expEnt = this.pojoEntries(this.expect) | ||
let out = '' | ||
@@ -371,0 +371,0 @@ for (const [key, val] of objEnt) { |
{ | ||
"name": "tcompare", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "A comprehensive comparison library, for use in test frameworks", | ||
@@ -17,11 +17,15 @@ "main": "index.js", | ||
"devDependencies": { | ||
"tap": "^13.0.0-rc.10" | ||
"tap": "^13.1.7" | ||
}, | ||
"scripts": { | ||
"test": "tap --100", | ||
"snap": "tap --snapshot", | ||
"test": "tap", | ||
"snap": "tap", | ||
"preversion": "npm test", | ||
"postversion": "npm publish", | ||
"postpublish": "git push origin --all; git push origin --tags" | ||
}, | ||
"tap": { | ||
"check-coverage": true, | ||
"coverage-map": "map.js" | ||
} | ||
} |
@@ -66,2 +66,5 @@ # tcompare | ||
* `sort` - Set to `true` to sort object keys. This is important when | ||
serializing in a deterministic way. | ||
* `style` - Set to `pretty` for a very human-readable style of object printing. | ||
@@ -68,0 +71,0 @@ Set to `js` for a copy-and-paste friendly valid JavaScript output. Set to |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38234
1102
135