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

assert-diff

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assert-diff - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

15

lib/assert-diff.js
var assert = require('assert-plus')
var jdiff = require('json-diff')
var opts = {strict: false}
module.exports = exports = function(options) {
opts = options
return module.exports
}
Object.keys(assert).forEach(function(key) {

@@ -22,4 +28,13 @@ module.exports[key] = function() {

}
if (opts.strict) {
var diff = jdiff.diff(arguments[0], arguments[1])
if (diff) {
throw new assert.AssertionError({
message: arguments[2] + '\u001b[m' + '\n' + jdiff.diffString(arguments[0], arguments[1]),
stackStartFunction: assert.AssertionError
})
}
}
}
exports.deepEqualOrig = assert.deepEqual

4

package.json
{
"name": "assert-diff",
"description": "Drop-in replacement for assert to give diff on deepEqual.",
"keywords": ["assert", "diff", "deepEqual", "object", "array"],
"keywords": ["assert", "diff", "deepEqual", "object", "array", "strict"],
"author": "Antti Mattila <pihvi@live.com>",
"repository": "git://github.com/pihvi/assert-diff",
"version": "0.0.2",
"version": "0.0.3",
"main": "./lib/assert-diff.js",

@@ -9,0 +9,0 @@ "license": "Apache 2.0",

@@ -32,1 +32,7 @@ var assert = require('./../lib/assert-diff')

})
it('strict diff deep equal', function() {
assert.deepEqual({a: 1, b: 2}, {a: true, b: "2"}, "this should not fail")
assert({strict: true}).deepEqual({a: 1}, {a: 1}, "this should not fail")
assert({strict: true}).deepEqual({a: 1, b: 2}, {a: true, b: "2"}, "this should fail")
})
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